我必須點擊應用程序中的關閉按鈕。所以,我試圖用xpath來標識元素,但是我最終得到的元素不是可見的異常。所以,我只是用Thread.sleep(5000)
並沒有拋出No Such Element exception
然後無法使用xpath識別webelement
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//img[@src='https://healthhomestg.gsihealth.com:6161/dashboard/dashboardapp/sc/skins/EnterpriseBlue/images/headerIcons/close.png']")));
但我仍然結束了No such element exception
。然後,在div標籤中的id和img標籤中的名稱會爲每個頁面加載動態更改。請幫我在確定的關閉按鈕,並點擊它,我用
的XPath:
"//img[@src='https://healthhomestg.gsihealth.com:6161/dashboard/dashboardapp/sc/skins/EnterpriseBlue/images/headerIcons/close.png']"
關閉按鈕代碼片段下面給出
<div id="isc_9L" class="imgButton" role="button" onscroll="return isc_ManageCareTeamWindow_0_closeButton.$lh()" style="position: absolute; left: 1057px; top: 2px; width: 15px; height: 15px; z-index: 202052; overflow: hidden; box-sizing: border-box; cursor: pointer; display: inline-block;" eventproxy="isc_ManageCareTeamWindow_0_closeButton">
<img width="15" height="15" border="0" align="TEXTTOP" draggable="true" suppress="TRUE" name="isc_9Lmain" src="https://healthhomestg.gsihealth.com:6161/dashboard/dashboardapp/sc/skins/EnterpriseBlue/images/headerIcons/close.png">
</div>
我評論過它。 – stanjer
謝謝,Stanjer。我嘗試了您提供的代碼,但沒有發生點擊操作。要強調的是,被測試的應用程序是使用GWT開發的,我想user-extensions.js和user-extensions-ide.js必須使用IDE或Selenium RC進行配置,但我應該在webdriver(硒) –