I'm trying to write xpath for one of the elements in a tree-like structure in the UI.
The tree looks like a windows file structure, like parent node, child. So, in order to find child node parent node has to be clicked.
+ [file icon] Book
|_ Book 1
|_ Book 2
|_ Book 3
Selenium gives the following xpath for the text 'Book' in above tree shown
//ul[@id='book_xxx']/li/ul/li[8]/span
when I click on file icon, selenium gave me following
//ul[@id='book_xxx']/li/ul/li[8]/img[1]
How can one write an xpath for clicking the file icon(i.e image) based on knowing the span text? I need the xpath for clicking on file icon image.