I'm using Python with webdriver
I'm trying to locate element with find element with xpath and get :"unexpected EOF while parsing (, line 1)"
When I try to locate it by finding element with class name, it works well.
The problem is that I can't use it since I have several classes with the same name.
Here is xpath:
here is the class name : st0
here is my code line:
ss = self.SELENIUM_DRIVER.find_element_by_xpath('//*[@id="j_id0:j_id5:j_id6:j_id36"]/div/div/div/div/div/ul/li/div/svg/g/g/path')
-Which does not work
ddd = self.SELENIUM_DRIVER.find_element_by_class_name('st0')
This is the html:
Thanks in advance
The following query will look for a
path with the parent tree of
div/svg/g/g, with a class equalling
st0 and at index
If the parent tree is unique from earlier on, it may be a good idea to make the query shorter, e.g.:
I think this is the problem with your provided Id
j_id0:j_id5:j_id6:j_id36 and as you are saying class name is same for some other elements as well, So you should try using
xpath by passing index as below :-
Now you can locate your desire element by just changing index value.
Hope it works...:)