Selenium WebDriver : How do I set capabilities ele

2019-02-28 13:47发布

I have a rails app that uses selenium-webdriver (2.53.0). I am trying to overcome to the issue with Selenium (with a Firefox driver) where buttons that scroll under a static header get hidden. How do I set capabilities elementScrollBehavior to 1 for a FireFox configuration in rails?

I have this code:

profile ||= Selenium::WebDriver::Firefox::Profile.new 

1条回答
欢心
2楼-- · 2019-02-28 14:43

My environment isn't set up the same as yours but capabilities object needs to be set.

require 'selenium-webdriver'

Capybara.register_driver :selenium do |app|

  http_client = Selenium::WebDriver::Remote::Http::Default.new
  http_client.timeout = 120

  capabilities = Selenium::WebDriver::Remote::Capabilities.firefox( :elementScrollBehavior => 1 )

  Capybara::Selenium::Driver.new(
    app,
    :browser => :firefox,
    :desired_capabilities  => capabilities,
    :http_client => http_client
  )
end
查看更多
登录 后发表回答