Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium Junit查找元素_Selenium_Junit_Selenium Webdriver_Webdriver - Fatal编程技术网

Selenium Junit查找元素

Selenium Junit查找元素,selenium,junit,selenium-webdriver,webdriver,Selenium,Junit,Selenium Webdriver,Webdriver,我是selenium的新手。我正在为网站的重复注册创建测试脚本。当重复注册显示错误时,我希望通过测试用例。 我对webelement的属性感到困惑。我不确定应该使用哪个字段,也不确定如何为显示的错误图像写入findelement 以下是显示的元素图像的HTML标记: <td> <img src="images/bell.png"> </td> 这适用于与错误图像一起显示的文本: <a onclick="if(typeof jsfcljs =

我是selenium的新手。我正在为网站的重复注册创建测试脚本。当重复注册显示错误时,我希望通过测试用例。 我对webelement的属性感到困惑。我不确定应该使用哪个字段,也不确定如何为显示的错误图像写入findelement

以下是显示的元素图像的HTML标记:

<td>
    <img src="images/bell.png">
</td>

这适用于与错误图像一起显示的文本:

<a onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.forms['navigation'],'navigation:j_id322,navigation:j_id322','');}return false" style="color:#000000;" href="#">Found 1 patient(s) with same Patient Name, Gender and Age. Click here to view details</a>


请帮助。谢谢

仅根据提供的详细信息,以下内容将有效

findElement(By.css("td>img[src='images/bell.png']")

然而,我确信,有比这更多的背景。如果没有完整的html,就很难给出更好的解决方案
findElement(By.css("a[onclick]")