我必须点击应用程序中的关闭按钮。所以,我试图用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(硒) –