table of Contents
- First, the conventional configuration TestNG eclipse
- Second, the configuration Selenium WebDriver
- Third, the browser downloads the corresponding drive
- Fourth, call the instance
- Four, IE promoter given
- Fifth, start Edge error
- Error message: urllib3.exceptions.ProtocolError
- 1, View edge version
- Method 1: Edge18 previous version
- Second way: After the release of Edge18
- Sixth, start Firefox error
First, the conventional configuration TestNG eclipse
There are two ways to install TestNG plugin, one is one is off-line.
1, offline
( 1 ) downloads the installation package testng into http://beust.com/eclipse download.
( 2 ) After downloading zipped file, click on "help" in eclipse menu bar, select the drop-down menu in the "Install New Software". The following interface
( 3 ) Click the Add button
( 4 ) project on the right can be seen in the following figure, the installation is successful
2, line installation
( 1 ) direct the picture, after entering Marktplace search TestNG, can be installed directly
3, the installation will ask
Whether online or offline installation process will appear stuck phenomenon
Note: Installation stuck solutions https://blog.csdn.net/qq_27009225/article/details/103743824
Second, the configuration Selenium WebDriver
1. Download
https://selenium.dev/downloads/
download the corresponding version of java
2, unzip the downloaded file
The file appears as follows
Note: You must have three files to import the project, import only issue an error message will appear outside the two jar package: java.lang.NoClassDefFoundError: com / google / common / collect / ImmutableMap
3, import file
Third, the browser downloads the corresponding drive
Three drive driver installed browser
- Chrome driver chromedriver Download: chromedriver
- Firefox Download Driver geckodriver: geckodriver
- Download Driver IEdriver IE: IEdriver
- Edge driver edgedriver Download: edgedriver
- Selenium IEDriverServer version number and version number must be consistent
View selenium Python version
1, Chrome drive
-
Each driver has its own version of Chrome browser version corresponding to the following pages for reference information.
http://chromedriver.storage.googleapis.com/2.43/notes.txt -
Download Driver Website http://chromedriver.storage.googleapis.com/index.html
Note: drive and browser versions do not correspond will get an error:
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:25606/status] to be available after 20012 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:107)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:190)
... 10 more
Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:140)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:80)
... 11 mor
2, configure the environment variables ChromeDriver
- Copy webdriver to file under Application Chrome browser installation directory
Of course, the configuration environment variable is not mandatory, but it will save a little thing
Fourth, call the instance
- If you configure webdriver environment variables do not have this line of code
System.setProperty("webdriver.chrome.driver","C:\\Program Files (x86)\\Google\\Chrome Beta\\Application\\chromedriver.exe");
System.setProperty("webdriver.chrome.driver",
// "C:\\Program Files (x86)\\Google\\Chrome Beta\\Application\\chromedriver.exe");
WebDriver wd = new ChromeDriver();
wd.get("https://www.baidu.com");
Thread.sleep(1000);
wd.findElement(By.id("kw")).sendKeys("I Love You!");
Thread.sleep(1000);
wd.findElement(By.id("su")).click();
Thread.sleep(1000);
wd.quit();
Four, IE promoter given
1、Unexpected error launching Internet Explorer
selenium.common.exceptions.SessionNotCreatedException: Message: Unexpected error launching Internet Explorer. Browser zoom level was set to 250%. It should be set to 100%
2, solve
3, the second method
Fifth, start Edge error
Error message: urllib3.exceptions.ProtocolError
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))
1, View edge version
At the bottom
Method 1: Edge18 previous version
Download the corresponding version of MicrosoftWebDriver
Second way: After the release of Edge18
Enter the command line
DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
Remember : this time to ensure the Python installation directory of the previous version did not MicrosoftWebDriver, otherwise Python will first find the default Python installation MicrosoftWebDriver directory, has been an error
Sixth, start Firefox error
1、Service geckodriver unexpectedly exited
Message: Service geckodriver unexpectedly exited. Status code was: 2
2, corresponding to the downloaded driver