Reputation: 262
In selenium on Java, im try to find an element and select it on a webpage but it keep getting the error:
The string '//*[@id='app']/article/div[2]/section/div[1]/div[5]/div/section[2]/div[2]/div[1]/' is not a valid XPath expression.
How can I get it at all??
Upvotes: 2
Views: 27907
Reputation: 193338
The reason you are seeing an error as not a valid XPath expression because you have exactly 2 issues in it as follows:
''
you can't use the same for the attribute values./
So your effective xpath will be either of the following:
'//*[@id="app"]/article/div[2]/section/div[1]/div[5]/div/section[2]/div[2]/div[1]'
or
"//*[@id='app']/article/div[2]/section/div[1]/div[5]/div/section[2]/div[2]/div[1]"
Upvotes: 6