我正在使用Watir-webdriver,Chromedriver(v2.27)和Chrome(v57)进行自动化
我的spec_helper有一行代码为@browser.window.maximize
自从更新到Chrome v57后,由于我收到以下错误,因此不再运行
Asset Section EULA and Intended Use The asset section behaves like eula and intended use EULA and Intended Use clicks Download and sees intended Use
Failure/Error: @browser.window.maximize
Selenium::WebDriver::Error::UnknownError:
unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=57.0.2987.133)
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Mac OS X 10.11.6 x86_64)
Shared Example Group: "eula and intended use" called from ./spec/smoke/public_view/asset_section_dl_share_spec.rb:65
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/response.rb:70:in `assert_ok'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/common.rb:78:in `new'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/common.rb:78:in `create_response'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/default.rb:90:in `request'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:649:in `raw_execute'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:627:in `execute'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:252:in `maximizeWindow'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/common/window.rb:117:in `maximize'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/watir-webdriver-0.6.11/lib/watir-webdriver/window.rb:96:in `block in maximize'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/common/target_locator.rb:73:in `window'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/watir-webdriver-0.6.11/lib/watir-webdriver/window.rb:200:in `use'
# /Users/kmancusi/.rvm/gems/ruby-2.2.2/gems/watir-webdriver-0.6.11/lib/watir-webdriver/window.rb:96:in `maximize'
# ./spec/spec_helper.rb:37:in `block (2 levels) in <top (required)>'
来自我的#spec_helper:
chrome_prefs = {
'profile' => {
'default_content_setting_values' => { 'automatic_downloads' => 1 }
}
}
config.before(:all) do
@browser = Watir::Browser.new :chrome, :prefs => chrome_prefs, switches: %w(--ignore-certificate-errors --disable-popup-blocking --disable-translate)
@browser.window.maximize
@browser.goto site
end
我相当有信心更新到v57造成这种情况。在我更新之前它正在工作,并且 - 现在 - 如果我发表评论@browser.window.maximize
它会运行
有什么想法吗?
答案 0 :(得分:0)
我遇到了同样的问题,最初通过删除browser.window.maximize并将以下内容添加到交换机来修复它:
client_id
然后在ChromeDriver版本2.28中修复了该问题(最新版本为2.29)。
ChromeDriver 2.28修复说明包括以下内容:
--start-maximized
可以下载here
同时检查测试输出以确保您实际使用的是已下载的新驱动程序,您将看到类似于&#34;启动ChromeDriver 2.xx.xxxxxx&#34;的内容。您可能有一些指向旧版ChromeDriver的配置。