8
<td colspan="2" align="center">
        <img src="web/L001/images/IMAGENAME.jpg" width="213" height="46" border="0" onclick="javascript: MessageDisplay()" ></td>

これは私がクリックしようとしている要素です。私の試みたコード:

WebElement temp = driver.findElement(By.xpath("web/L001/images/Phishing_12.jpg"));
temp.click();

私も完全なアドレスで試してみましたが、アイデアをいただければ幸いです。

これを使用してさまざまな Web サイトにログオンしますが、この特定の Web ページが表示される前に、その要素をクリックしてから続行する必要があります。-どうも

4

2 に答える 2

16

This xpath should find it

WebElement temp = driver.findElement(By.xpath("//img[@src='web/L001/images/IMAGENAME.jpg']"));

or use contains like so

WebElement temp = driver.findElement(By.xpath("//img[contains(@src,'web/L001/images/IMAGENAME.jpg')]"));

But i think the problem would be is that you are not waiting for the element.

于 2013-08-23T16:19:47.300 に答える