Python Forum
Why Xpath is not selecting the correct path - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Why Xpath is not selecting the correct path (/thread-5101.html)



Why Xpath is not selecting the correct path - Prince_Bhatia - Sep-19-2017

i have written a code that picks data from excel enter into my offiice backend, in backend there is path where it needs to click submit button to enter entries

when i run this code it picks data for first row perfectly and when it reaches second row it select different xpath which i didnt mentioned in my codes

to submit the button there are two xpaths and those are :

//[@id="editprojdetails_frm"]/table[2]/tbody/tr[9]/td/input[1] //[@id="editprojdetails_frm"]/table[2]/tbody/tr[10]/td/input[1]
and this is my code

    xid = driver.find_element_by_xpath('//*[@id="editprojdetails_frm"]/table[2]/tbody/tr[10]/td/input[1]|//*[@id="editprojdetails_frm"]/table[2]/tbody/tr[9]/td/input[1]')
    xid.click()
    time.sleep(2)
it iterates through first row of my excel to pick data when it reaches to second column it selects :

//*[@id="editprojdetails_frm"]/table[2]/tbody/tr[9]/td[1]/input
but it should select from above two xpaths where i used | this operator to join them, any suggestions?