简体   繁体   English

查找xpath并从硒中的锚标签获取值

[英]Find xpath and get the value from anchor tag in selenium

I have been working on java project which needs the selenium testing tool for running the test class. 我一直在研究Java项目,该项目需要使用硒测试工具来运行测试类。 As per the requirement, I need to know how to write the xpath, and how to get the value (goodluck) using xpath for given tag. 根据要求,我需要知道如何编写xpath,以及如何使用xpath获取给定标记的值(goodluck)。

<span class="clienthome" id="personTableForm:foundClientsTable:0:j_id118">
                        goodluck</span>

Please anyone kindly help me. 请任何人帮助我。

try - //span[@class='clienthome']/.[normalize-space(text())='goodluck'] 试试-//span[@class='clienthome']/..[normalize-space(text())='goodluck']

or 要么

//span[normalize-space(text())='goodluck'] // span [normalize-space(text())='goodluck']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM