<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<img src="/images/ic_highlight_removegray.svg" alt="">
</button>
私はこのポップアップ(X)画像をクリックしてみましたが、それはリンクです。私はXpath、クラス& cssSelectorsを含むすべての可能なセレクタでこれを行いましたが、結果はありません。これは画像/ボタンの特殊なケースです。画像をボタンとしてクリックしますか?
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Thread.sleep(35000);
driver.findElement(By.xpath(".//*[@id='share_preview_modal']/div/div[1]/button")).click();
Iはまた、待機、相対&絶対のXPath、.sendKeys(Keys.ENTER)と同じ試みました。 - 失敗
<div id="share_preview_modal" class="modal fade pro_info_member in dashboard-modal" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-labelledby="user_profile" style="display: block;">
<div class="modal-dialog " role="document">
<div class="modal-header">
<div class="preview-header">
<span class="success-msg white_box_info" style="display:none">Restricted email access to domains </span>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<img src="http://some-url/images/ic_highlight_removegray.svg" alt="">
</button>
</div>
<div class="modal-content white-popup " style="background-image: url("");">
<!-- white popoup -->
</div>
</div>
次のXPath試してみてください:[=クラス@ '// IMG [@src = '/画像/ ic_highlight_removegray.svg']' ' –
//ボタンを[close]] [@ data-dismiss = 'modal'] [@ aria-label = 'Close'] ' –
クイックレスポンス' Kishan 'に感謝していますが、共用xpathも機能しません。 –