尝试使用Selenium Webdriver v3.70最大化浏览器窗口时出现Ruby"KeyError:key not found:102"错误

dan*_*own 9 ruby selenium selenium-webdriver

我最近将我的Selenium Webdriver版本升级到3.70,当我尝试最大化浏览器窗口时,我收到此错误:

KeyError:找不到密钥:102

事先最大化窗口(在以前的版本)似乎运作精绝,我不知道这是否只是一个巧合,虽然,因为它不是一个标准型硒错误.

这是我的代码:

  profile = Selenium::WebDriver::Chrome::Profile.new
  $driver = Selenium::WebDriver.for :chrome, :profile => profile
  $driver.manage.window.maximize
Run Code Online (Sandbox Code Playgroud)

其他人有这个问题吗?另外值得注意的是我正在使用Ruby v2.3.1,所以也许需要更新?我只是不想做大量的更新,但想要最新的Selenium Webdriver版本.我也不知道它是否与chromedriver相关,但最后更新于19/09/17的最新版本.

提前谢谢,丹

小智 9

升级chromedriver2.33.

在Mac上,您可以通过brew升级它 brew upgrade chromedriver