0

I am trying to find a Submit Button on a webpage, however using xPath is not working to find it for some strange reason, and it has no class, name, or id. The line itself in the webpage is below.

The xPath is

/html/body/div[3]/form/input[2]

but like I said, it can't find it this way for some reason. The selector is

body > div.pagebodydiv > form > input[type="submit"]:nth-child(5)

I just need to press this button and I can't figure out how. Please help. It is the Submit Button

  • Can you post the web here? – Phung Duy Phong May 12 '17 at 05:59
  • I cannot post the webpage unfortunately as it requires a login and password to reach, however I can post a screenshot of the page and the button I am needing to press. Is what is in the inspection category when I inspect the Submit button. – Bradley Schott May 14 '17 at 02:58
  • The method indicated in http://stackoverflow.com/questions/43183736/beautifulsoup-does-not-returns-all-data/43191283#43191283 might work for you. – Bill Bell May 14 '17 at 03:10

1 Answers1

0

You could try using '//', meaning can be found here https://www.w3schools.com/xml/xpath_syntax.asp

xpath_selector = "//input[@value = 'Submit']"

OR:

xpath_selector = "//input[@value = 'Submit' and @type = 'submit']"

OR

xpath_selector = "//input[starts-with(@value, 'Submit') and starts-with(@type, 'submit')]

The way your are currently focusing on could easily cause error if page change a tiny bit in structure, moreover, selecting from root takes a lot of effort.

Phung Duy Phong
  • 876
  • 6
  • 18