Python Forum
Why Xpath is not selecting the correct path
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why Xpath is not selecting the correct path
#1
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Selecting correct xlrd version Kithsiri 4 549 Feb-27-2024, 07:09 AM
Last Post: Kithsiri
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 2,210 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  .pth file does not show up in sys.path when configuring path. arjunsingh2908 2 5,766 Jul-03-2018, 11:16 AM
Last Post: arjunsingh2908
  setting correct path for P2 after uninstalling Py 3 kwfreverie 3 3,000 Feb-02-2018, 08:12 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020