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