Quickly specify the XPATH on the page using the Chrome extension xPath Finder.
And send the input items there with send_keys etc.
The following is an excerpt of the SBI SECURITIES login script.
try:
browser.get('https://www.sbisec.co.jp/ETGate')
username_field = browser.find_element_by_xpath('/html/body/table/tbody/tr[1]/td[2]/form/div/div/div/dl/dd[1]/div/input')
username_field.clear()
username_field.send_keys(username)
password_field = browser.find_element_by_xpath("/html/body/table/tbody/tr[1]/td[2]/form/div/div/div/dl/dd[2]/div/input")
password_field.send_keys(password)
login_button = browser.find_element_by_xpath("/html/body/table/tbody/tr[1]/td[2]/form/div/div/div/p[2]/a/input")
login_button.click()#click login
time.sleep(5)
With this pattern, projects using Selenium will progress at once.
--2020/06/06 Newly created
Recommended Posts