Chrome瀏覽器版本:43.0.2357.134米Chrome瀏覽器沒有獲得通過調用硒
硒版本:硒的Java-3.0.0-β2
代碼:
package Selenium_Practice;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Launch_NewGen {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\Selenium_Practice\\EXEs\\chromedriver_win32\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://google.com");
}
錯誤:
Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 19613 Only local connections are allowed. Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Chrome version must be >= 51.0.2704.0 (Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 1.56 seconds Build info: version: 'unknown', revision: '2aa21c1', time: '2016-08-02 14:59:43 -0700' System info: host: 'LON-EKNATHDVM', ip: '10.63.23.191', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_102' Driver info: org.openqa.selenium.chrome.ChromeDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:683) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:130) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:143) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:170) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:159) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:116) at Selenium_Practice.Launch_NewGen.main(Launch_NewGen.java:17)
這是鉻瀏覽器版本不支持的情況嗎?沒有升級Chrome瀏覽器,有沒有可能的解決方案?
作爲例外明確規定,你需要升級你的Chrome瀏覽器版本,以及...否則降級硒版本..: ) –
在我的情況下,硒3.0工作正常,但最新的Chrome瀏覽器版本和最新的chromedriver 2.23。更新Chrome瀏覽器或使用舊版本的硒和可能的chromedriver。對於最新的硒,我發現你需要先指定驅動程序,然後在-jar selenium-server.jar選項 – lauda