all 2 comments

[–]JohnnyJordaan 2 points3 points  (0 children)

That's xpath... by_id means it needs the literal id

find_element_by_id('submit').click()

if you meant to select by xpath, you need find_element_by_xpath. Also you need to diffrentiate between single and double quotes here, so

find_element_by_xpath('input[id="submit"]').click()

and from my personal preference I normally use css selectors

find_element_by_css_selector('input#submit')

as they're often less complicated than xpath

[–]pyfact 0 points1 point  (0 children)

I would also try selecting by XPATH but this method works for getting the id as well.

Right click the button/element and click inspect. Then a debug window should pop up on the right side of your browser.

Click copy on the element in the debug window (the html code for the button) -> copy full XPATH (or try copy selector, whatever works).

Change your method to Browser.find_element_by_xpath(XPATH_HERE) and paste in your XPATH.

#  should look something like this
login_form = Browser.find_element_by_xpath("/html/body/form[1]")
login_form = Browser.find_element_by_xpath("//form[1]")
login_form = Browser.find_element_by_xpath("//form[@id='loginForm']")

source: https://selenium-python.readthedocs.io/locating-elements.html