阅读 178

SyntaxError

SyntaxError

Can anyone please tell me, if there is any mistake with my xpath. I have made it dynamic, to accept values from the parameter passed.

Xpath used in my code as :

wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//div[@id='categories_block_left']/div[1]/ul[1]/li/a[contains(text(),'"+subCategory+"')]/Preceding-sibling::span[1]")));

Xpath I am getting on run time in the console after execution:

//div[@id='categories_block_left']/div[1]/ul[1]/li/a[contains(text(),'Tops')]/Preceding-sibling::span[1]

If I try to inspect above(runtime) by mentioning xpath in Firpath console, it is getting detected. But selenium is not able to detect this element.

Here is page URL:

http://automationpractice.com/index.php?id_category=3&controller=category

In the eclipse console I am getting error as :

Expected condition failed: waiting for presence of any elements located by By.xpath: //div[@id='categories_block_left']/div[1]/ul[1]/li/a[contains(text(),'Tops')]/Preceding-sibling::span[1]
SyntaxError: Failed to execute 'evaluate' on 'Document':


©著作权归作者所有:来自51CTO博客作者mjl8800的原创作品,如需转载,请注明出处,否则将追究法律责任


文章分类
后端
文章标签
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐