<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也无法正常工作。 –