selenium achieve NetEase mailbox Login Register

1  # achieve registration site 163 
2  from Selenium Import the webdriver
 . 3  Import Time
 . 4 Driver = webdriver.Chrome ()
 . 5 URL = ' https://mail.163.com/ ' 
. 6  driver.get (URL)
 . 7  # Location Register New account 
. 8 EL = driver.find_element_by_xpath ( ' // * [@ ID = "commonOperation"] / A [2] ' ) .click ()
 . 9 the time.sleep (. 5 )
 10  # switches to handle the registration page 
. 11 hand_list = Driver. window_handles
 12 driver.switch_to.window(hand_list[1])
13 driver.find_element_by_xpath('//*[@id="username"]').send_keys('[email protected]')
14 driver.find_element_by_xpath('//*[@id="password"]').send_keys('cd123456')
15 driver.find_element_by_xpath('//*[@id="phone"]').send_keys('17762443345')
16 driver.find_element_by_xpath('/html/body/div[2]/div/div/div[2]/div[4]/span') .click ()
 . 17 driver.find_element_by_xpath ( ' / HTML / body / div [2] / div / div / div [2] / div [. 5] / A [. 1] ' ) .click ()
 18 is  # 163 website logins 
. 19  from Selenium Import the webdriver
 20 is  Import   Time
 21 is Driver = webdriver.Chrome ()
 22 is main_url = " https://mail.163.com/ " 
23 is  driver.get (main_url)
 24 the time.sleep (. 3 )
 25  # click switch to login in 
26 driver.find_element_by_id ( " switchAccountLogin " ) .click ()
27 #找到iframe
28 login_iframe=driver.find_element_by_xpath('//iframe[starts-with(@id, "x-URS-iframe")]')
29 driver.switch_to.frame(login_iframe)
30 username=driver.find_element_by_xpath('//input[@name="email"]')
31 password=driver.find_element_by_xpath('//input[@name="password"]')
32 username.send_keys("[email protected]")
33 password.send_keys("cd123456")
34 driver.find_element_by_xpath('//a[@id="dologin"]').click()
35 driver.find_element_by_xpath('//*[@id="_mail_component_53_53"]').click()

Although he is not familiar with, which is also being given, every red I was thinking that he is not really not suitable to learn code.

Good programmers are to have knock knock still have to practice more practice and more practice

 

Guess you like

Origin www.cnblogs.com/zqxFly/p/12311642.html