无法通过selenium单击“部署”链接按钮。如何单击“环境”按钮?
代码如下:
<a title="Deployments, Level 1, 2 of 6" class="tree_link"
id="linkAppDeploymentsControlPage" href="/console/console.portal?_nfpb=true&_pageLabel=AppDeploymentsControlPage"
onkeypress="checkKeyStroke(event);" onmouseover="mouseOverCall('AppDeploymentsControlPage', 'popup');"
onmouseout="mouseOutCall('AppDeploymentsControlPage');"
oncontextmenu="return startDisplayPopup('AppDeploymentsControlPage', 'popup', event);">Deployments</a>
<span id="placeholderAppDeploymentsControlPage"></span>
<a title="Deployments, Level 1, 2 of 6" href="/console/console.portal?_nfpb=true&_pageLabel=AppDeploymentsControlPage">
<img id="iconAppDeploymentsControlPage" src="images/spacer.gif" align="absbottom" alt=""
border="0" onmouseover="mouseOverCall('AppDeploymentsControlPage', 'popup');"
onmouseout="mouseOutCall('AppDeploymentsControlPage');" oncontextmenu="return startDisplayPopup('AppDeploymentsControlPage', 'popup', event);"
title="Deployments">
</a>
<img id="iconAppDeploymentsControlPage" src="images/spacer.gif" align="absbottom" alt=""
border="0" onmouseover="mouseOverCall('AppDeploymentsControlPage', 'popup');"
onmouseout="mouseOutCall('AppDeploymentsControlPage');" oncontextmenu="return startDisplayPopup('AppDeploymentsControlPage', 'popup', event);"
title="Deployments">
我尝试使用下面的代码选项,但它仍然没有反映我的更改或无法点击部署链接:
driver.findElement(By.className("iconAppDeploymentsControlPage")).click();
//driver.findElement(By.className("formButton")).click();
//driver.findElement(By.className("iconAppDeploymentsControlPage")).click();
//driver.findElement(By.className("tree_link")).click();
//driver.findElement(By.xpath("//img[@ src='images/shim.gif']")).click();
//driver.findElement(By.className("images/spacer.gif")).click();
//driver.findElement(By.className("Deployments")).click();
//driver.findElement(By.className("wlsc-titlebar-button-panel")).click();
答案 0 :(得分:0)
如果您尝试点击带有文字&#34;部署&#34;的链接。你可以这样做:
driver.findElement(By.xpath("//a[text()='Deployments']")).click();