当尝试使用下面的代码打开Chrome驱动程序时,出现以下异常。无法使用硒打开Chrome驱动程序
铬窗口自动打开和关闭。 我的Chrome版本:12.0.712.0和Chrome驱动程序版本26.0.1383.0
我使用的代码是:
System.setProperty("webdriver.chrome.driver","F:\\chromedriver.exe");
ChromeDriver cd = new ChromeDriver();
cd.get("http://www.gmail.com");
tarted ChromeDriver
port=10298
version=26.0.1383.0
log=F:\Selnium\Module11\chromedriver.log
Exception in thread "main" org.openqa.selenium.WebDriverException: Unknown command. Options: ActivateTab, CloseTab, DeleteCookie, ExecuteJavascript, GetCookies, GetIndicesFromTab, GetTabIds, GetTabTitle, GetTabURL, GoBack, GoForward, IsTabIdValid, NavigateToURL, Reload, SendWebkitKeyEvent, SetCookie, WaitForAllTabsToStopLoading, WebkitMouseClick, WebkitMouseDrag, WebkitMouseMove, AddHistoryItem, AddOrEditSearchEngine, AddSavedPassword, AwaitSyncCycleCompletion, ClearBrowsingData, CloseNotification, DisablePlugin, DisableSyncForDatatypes, EnablePlugin, EnableSyncForDatatypes, FillAutofillProfile, FindInPage, GetActiveNotifications, GetAutofillProfile, GetBlockedPopupsInfo, GetBrowserInfo, GetDownloadsInfo, GetExtensionsInfo, GetHistoryInfo, GetInitialLoadTimes, GetInstantInfo, GetNTPInfo, GetNTPMenuMode, GetNTPThumbnailMode, GetNavigationInfo, GetOmniboxInfo, GetPluginsInfo, GetPrefsInfo, GetSavedPasswords, GetSearchEngineInfo, GetSyncInfo, GetThemeInfo, GetTranslateInfo, ImportSettings, KillRendererProcess, LoadSearchEngineInfo, MoveNTPMostVisitedThumbnail, OmniboxAcceptInput, OmniboxMovePopupSelection, PerformActionOnDownload, PerformActionOnInfobar, PerformActionOnSearchEngine, RemoveNTPMostVisitedThumbnail, RemoveSavedPassword, RestoreAllNTPMostVisitedThumbnails, SaveTabContents, SelectTranslateOption, SetNTPMenuMode, SetNTPThumbnailMode, SetOmniboxText, SetPrefs, SetWindowDimensions, SignInToSync, UnblockAndLaunchBlockedPopup, UninstallExtensionById, UnpinNTPMostVisitedThumbnail, WaitForAllDownloadsToComplete, WaitForNotificationCount, (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.65 seconds
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'ANKUR-PC', ip: '169.254.81.96', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_40'
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:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.chrome.ChromeDriver.startSession(ChromeDriver.java:182)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(`enter code here`RemoteWebDriver.java:115)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:161)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:150)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:107)
at Selenium.main(Selenium.java:39)
更新您的浏览器版本 –
Prashnath thanks for reply。你知道我应该更新哪个Chrome版本吗? –
Chrome 25+版本;使用最新的Chrome驱动。 http://chromedriver.storage.googleapis.com/index.html?path=2.9/ –