Java Selenium:在会话上找不到元素
我正在使用Selenium RC Java。 请求:单击打印以“?product=”结尾的页面中的所有链接,然后逐个单击 链接没有ID。因此,我使用XPATH 请检查我的密码Java Selenium:在会话上找不到元素,java,selenium-rc,Java,Selenium Rc,我正在使用Selenium RC Java。 请求:单击打印以“?product=”结尾的页面中的所有链接,然后逐个单击 链接没有ID。因此,我使用XPATH 请检查我的密码 selenium.open("http://s4.com"); int count= selenium.getXpathCount("xpath=//a[contains(@href, '?product=')]").intValue(); for(int i=1;i<count;i++) { selenium.
selenium.open("http://s4.com");
int count= selenium.getXpathCount("xpath=//a[contains(@href, '?product=')]").intValue();
for(int i=1;i<count;i++)
{
selenium.click("xpath=//a[contains(@href, '?product=')]["+ i +"]");
}
我也想打印链接。有什么办法吗?因为您没有包括实际链接的示例,我猜末尾的数字与您要查找的格式不匹配。嗨,鲍勃,链接是、、等等。这是我们的登台站点嗨,我刚刚找到了正确的代码selenium;成功了!谢谢…谢里奥
14:19:27.907 INFO - Command request: getXpathCount[xpath=//a[contains(@href, '?product=')], ] on session e4da58d4bf7d4eb6a7aa8238135fc969
14:19:28.950 INFO - Got result: OK,4 on session e4dawerdfsdf34aa8238135fc969
4
14:19:28.956 INFO - Command request: click[xpath=//a[contains(@href, '?product=')][1], ] on session e4dasdfs3434erererdf38135fc969
14:19:29.994 INFO - Got result: ERROR: Element xpath=//a[contains(@href, '?product=')][1] not found on session e4da58d4bf7d4eb6afsd343fdsf135fc969