Python login 126 Email
Because just started to learn automated testing, so has been followed by the worm "Selenium automation Test Practice" to learn, in which the use of Python Landing 126 mailbox, practice found that the latest version of the 126 mailbox can not be automated according to the ID to log in, the steps are as follows:
1. The first choice uses the CSS localization method to log in, the result error an invalid or illegal selector is specified (specified invalid or illegal selector)
2. Then use the XPath positioning, the result is an error unable to the find element with XPath = =//input[@name = ' email '), from the online search, found that 126 mailbox landing box is in an IFRAME framework, You must include the following code in your code
Driver.switch_to_frame ("x-urs-iframe")
3. When I run the code to see the input box start to enter the default content in the code, the results found that my code can not get to the login button click event (Tears ben ~ ~ ~), find a half-day finally found a solution, the code is as follows:
fromSeleniumImportWebdriver fromSelenium.webdriver.commonImportKeysImportTimedriver=Webdriver. Ie () Driver.get ("http://www.126.com") Driver.switch_to_frame ("X-urs-iframe") Driver.find_element_by_xpath ("//input[@name = ' email ')"). Clear () Driver.find_element_by_xpath ("//input[@name = ' email ')"). Send_keys ("username") Driver.find_element_by_xpath ("//input[@name = ' password ')"). Clear () Driver.find_element_by_xpath ("//input[@name = ' password ')"). Send_keys ("Password") Driver.find_element_by_xpath ("//input[@name = ' password ')"). Send_keys (keys. Keys.enter)
Reference Link: http://blog.csdn.net/miouqi/article/details/68950257
Python login 126 Mailbox record