Python login 126 Mailbox record

Source: Internet
Author: User
Tags xpath

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.