Java 在上找不到元素http://automationpractice.com

Java 在上找不到元素http://automationpractice.com,java,selenium,webdriver,Java,Selenium,Webdriver,我使用下面的xpath在 我不确定是什么问题 如果我尝试使用Linktext来定位它,它是有效的,但是我想知道为什么上面的xpath不起作用。因为attribute:title的值包括新行,但是您在一行中给定了所有字符串 只需将值复制到记事本中,即可获得以下字符串: You will find here all woman fashion collections. This category includes all the basics of your wardrobe and much

我使用下面的xpath在

我不确定是什么问题


如果我尝试使用Linktext来定位它,它是有效的,但是我想知道为什么上面的xpath不起作用。

因为attribute:title的值包括新行,但是您在一行中给定了所有字符串

只需将值复制到记事本中,即可获得以下字符串:

You will find here all woman fashion collections.  
 This category includes all the basics of your wardrobe and much more: 
 shoes, accessories, printed t-shirts, feminine dresses, women's jeans!
您可以使用字符串函数
normalize-space()
删除新行和冗余空间

//a[normalize-space(@title)='Choose from t-shirts, tops, blouses, short sleeves, long sleeves, tank tops, 3/4 sleeves and more. Find the cut that suits you the best!']
没有像Choose from t恤那样的标题可见元素。。。。您的具体手动步骤是什么?
//a[normalize-space(@title)='Choose from t-shirts, tops, blouses, short sleeves, long sleeves, tank tops, 3/4 sleeves and more. Find the cut that suits you the best!']