Python Forum

Full Version: Why Xpath is not selecting the correct path
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?