Selenium+python Automated Testing (ii) Simple operation of the browser

Source: Internet
Author: User

1. Maximizing

Maximize_window
1 #coding = Utf-82 3  fromSeleniumImportWebdriver4Chromedriver ="C:\Program Files (x86) \google\chrome\application\chromedriver"5Browser =Webdriver. Chrome (Chromedriver)6 7Browser.get ('http:\\www.baidu.com')8 Browser.maximize_window ()9BROWSER.FIND_ELEMENT_BY_ID ('kw'). Send_keys ('Selenium')TenBROWSER.FIND_ELEMENT_BY_ID ('su'). Click () One  ABrowser.quit ()
View Code

Found the operation time error:

Selenium.common.exceptions.WebDriverException:Message:disconnected:unable to connect to renderer
(Session info:chrome=62.0.3202.94)
(Driver info:chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41), platform=windows NT 6.1.7601 SP1 x86_64)

Is that chrome and chromedriver versions do not correspond. Keyword search under the cause of the discovery. And then downloaded a newer version.

http://chromedriver.storage.googleapis.com/index.html?path=2.34/

Just run OK with the replacement.

Selenium+python Automated Testing (ii) Simple operation of the browser

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.