<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();
我還試圖用相同的等待,相對&絕對的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 ='關閉']' –
感謝您對'Kishan'的快速響應,但共享xpath也無法正常工作。 –