Do automation often encounter incompatible problems, such as the following simple script, mainly open the browser, and then maximize the window, open Baidu, input content search, the code is as follows:
PackageCom.gs.selenium;Importorg.openqa.selenium.By;ImportOrg.openqa.selenium.WebDriver;ImportOrg.openqa.selenium.chrome.ChromeDriver;Importorg.openqa.selenium.chrome.ChromeOptions; Public classDemo1 { Public Static voidMain (string[] args) {System.setproperty ("Webdriver.chrome.driver", "E:\\ware\\selenium\\chromedriver_win32\\chromedriver.exe"); Chromeoptions Options=Newchromeoptions (); Options.addarguments ("Disable-infobars");//set the Chrome browser's parameters so that it doesn't pop-up (Chrome is under the control of the automated test software)Webdriver Dr=Newchromedriver (options); Dr.manage (). window (). Maximize ();//Maximize Your browserDr.get ("https://www.baidu.com");//Open the URL you want to test, such as Baidudr.findelement (By.id ("KW")). SendKeys ("Hello");//Enter search keywordsSystem.out.print ("open page"); Try{Thread.Sleep (6000); } Catch(interruptedexception e) {//TODO Auto-generated catch blockE.printstacktrace (); } dr.close ();//Close Browser}
Selenium 3.7 version enlarged browser window error is as follows
Error: Exception in thread ' main ' org.openqa.selenium.WebDriverException:disconnected:unable to connect to renderer
To view the error, the script runs to the window to maximize the errors, after careful analysis, found that the Chrom version is 62, incompatible with the chromedriver caused by the problem.
Workaround:
Go to the following URL to download the Chromedriver:
https://npm.taobao.org/mirrors/chromedriver/
After the download, run the above script, the problem is resolved successfully.
Finally, attach the Java Project jar package diagram:
Error org.openqa.selenium.WebDriverException:disconnected:unable to connect to renderer solution