1 from selenium import webdriver 2 from time import sleep 3 bro = webdriver.Chrome(executable_path='chromedriver.exe') 4 5 bro.get('http://www.4399.com/') 6 7 a_login = bro.find_element_by_id('login_tologin') 8 sleep(1) 9 a_login.click() 10 sleep(1) 11 bro.switch_to.frame('popup_login_frame') 12 Username_tag = bro.find_element_by_id('username') 13 password_tag = bro.find_element_by_id('j-password') 14 15 sleep(1) 16 Username_tag.send_keys("123456789") 17 sleep(1) 18 password_tag.send_keys("123456789") 19 sleep(1) 20 21 btn_login = bro.find_element_by_xpath('//*[@id="login_form"]/fieldset/div[5]/input') 22 btn_login.click() 23 sleep(3) 24 bro.quit()