【发布时间】:2017-03-24 14:21:42
【问题描述】:
我在我的 Ubuntu 服务器 (16.04) 上安装了最新的 Google Chrome 57.0.2987.110。 我正在使用树冠(这是 Selenium 的 F# 包装器)。 我将最新的 chromedriver 放在与我的二进制文件相同的文件夹中,版本:2.28.455506(并且我设置了正确的驱动程序路径)。
我正在使用--headless 参数启动chrome,如下所示:
let chromeOpts = ChromeOptions ()
chromeOpts.AddArgument "--headless"
chromeOpts.AddArgument "--disable-gpu"
chromeOpts.AddArgument "start-maximized"
start <| ChromeWithOptions chromeOpts
一开始我就收到这个错误:
[错误] 致命的未处理异常:System.InvalidOperationException:未知错误:无法获得自动化扩展 来自未知错误:找不到页面:chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html (会话信息:内容外壳=) (驱动程序信息:chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),平台=Linux 4.4.0-64-generic x86_64) 在 OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError (OpenQA.Selenium.Remote.Response errorResponse) [0x000d5] 在 :0 在 OpenQA.Selenium.Remote.RemoteWebDriver.Execute (System.String driverCommandToExecute, System.Collections.Generic.Dictionary`2[TKey,TValue] 参数) [0x00046] in :0 在 OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute (System.String driverCommandToExecute, System.Collections.Generic.Dictionary 2[TKey,TValue] 参数) [0x00000] in :0 在 OpenQA.Selenium.Remote.RemoteWindow.set_Size (System.Drawing.Size 值) [0x00067] 在 :0 在 canopy.core.pin (canopy.types+direction 方向) [0x0002f] in :0 在 canopy.core.start (canopy.types+BrowserStartMode b) [0x0050c] in :0
似乎无法设置窗口大小。 启动无头 Chrome 的正确方法是什么?我在某处读到最新版本具有无头功能。 由于我使用的是最新版本的 Google Chrome 和 chromedriver,我认为这不应该是版本不匹配。
此外,它在具有相同版本 chromedrive 的本地 Windows 10 机器上运行良好(仅适用于 Windows)。
【问题讨论】:
标签: google-chrome selenium selenium-webdriver selenium-chromedriver canopy-web-testing