python - Select an input element using Selenium -


inspect

im trying click on button move login page. code :

from selenium import webdriver driver = webdriver.chrome() driver.get('http://moodle.tau.ac.il/') 

thats work fine can find form using

loginform = driver.find_element_by_xpath("//form[@id='login']/") 

i don't know how button, it's basic stuff didn't find example.

this click on login button on moodle.tau.ac.il page. line driver.find_element_by_xpath(".//*[@id='login']/div/input").click() finds login button on page , clicks it. xpath selector type can use selenium find web elements on page. can use id, classname, , cssselectors.

from selenium import webdriver  driver = new webdriver.chrome()  driver.get('moodle.tau.ac.il') # take login page. driver.find_element_by_xpath(".//*[@id='login']/div/input").click()  # fills out login page elem = driver.find_element_by_xpath("html/body/form/table/tbody/tr[2]/td/table/tbody/tr[1]/td[2]/input") elem.send_keys('your username') elem = driver.find_element_by_xpath("html/body/form/table/tbody/tr[2]/td/table/tbody/tr[3]/td[2]/input") elem.send_keys('your id number') elem = driver.find_element_by_xpath("html/body/form/table/tbody/tr[2]/td/table/tbody/tr[1]/td[2]/input") elem.send_keys('your password') driver.find_element_by_xpath("html/body/form/table/tbody/tr[2]/td/table/tbody/tr[7]/td[2]/input").click() 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -