2017-10-18 74 views
0

()問題的ChromeDriver 2.33的發行說明說:「」修復造成尺寸/定位窗口命令失敗在Chrome 6 2+的錯誤」,然而這仍然當我使用Chrome瀏覽器62 +瀏覽器時,似乎是一個問題。使用鉻驅動程序最大化鉻窗口導致以下例外。有沒有人知道一個解決方案,請?driver.manage()。窗口()。最大限度地與ChromeDriver 2.33

另一件我注意到的是,雖然我安裝了最新的chromedriver(v2。 33)從https://chromedriver.storage.googleapis.com/index.html?path=2.33/,下面打印的日誌說驅動信息:chromedriver = 2.25.426923 !!

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html (Session info: chrome=62.0.3202.62) (Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 10.0.15063 x86_64) (WARNING: The server did not provide any stacktrace information)

+0

那麼,什麼是你的問題是什麼呢? – Sand

+0

有沒有人知道這個解決方案?無法使用提及的驅動程序版本和Chrome瀏覽器最大化瀏覽器。 – marjava

+0

所以發生這種情況時,要最大限度的瀏覽器,你寫一個程序或者是有任何的代碼基礎,促使這個問題? – Sand

回答

0

使用類ChromeOptions。

System.setProperty("webdriver.chrome.driver", "h:\\chromedriver.exe"); 
     ChromeOptions options = new ChromeOptions(); 
     options.addArguments("disable-infobars"); 
     options.addArguments("--start-maximized"); 
     WebDriver driver = new ChromeDriver(options); 
     driver.get(url); 
2

恰好有2個問題。

  1. 正如你所說,你已經安裝了最新的chromedriver(v2.33),但低於打印日誌說驅動程序信息:chromedriver = 2.25.426923,這個問題必須首先解決。你可以考慮手動殺死所有從Task Manager的晃來晃去chromedriver.exe任務。此外,您可以考慮使用CCleaner從系統中清除所有的爛東西操作系統。根據需要重新啓動系統。最後確保你在絕對位置chromedriver.exe你正在使用System.setProperty()確保chromedriver二進制版本是2.33。

  2. 最後,建議使用ChromeOptionsmaximize Web瀏覽器如下:

    System.setProperty("webdriver.chrome.driver", "C:\\your_directory\\chromedriver.exe"); 
    ChromeOptions opt = new ChromeOptions(); 
    opt.addArguments("disable-infobars"); 
    opt.addArguments("--start-maximized"); 
    opt.addArguments("--disable-extensions"); 
    WebDriver driver = new ChromeDriver(opt); 
    driver.get("https://google.com"); 
    
  3. 有關錯誤cannot get automation extension from unknown error你也可以參考這個QA/Discussion

0

我相信有一些舊的chrome驅動程序進程在後端運行,當它通過代碼被調用時,它們正在被拾取。我刪除了所有流程實例,刪除了舊版本的chrome驅動程序,添加了新的2.33版本,並且工作正常。非常感謝您的建議。