2
I’m starting to learn how to use a means for test automation in web applications. However, I came across a problem that I can’t solve and I can’t find anywhere (questions or documentation) that explains a method that would solve my problem.
Well, first of all I’m using Selenium + Cucumber + Capybara (in ruby) and basically I wish I could perform tests in the Chrome browser with mobile emulation and what prevents me from this is that with my settings inside env.Rb when I run Cucumber a Chrome window with the url "data;" and then another window is created where my script runs normally (I noticed that this happens not only with the Chrome webdriver but with Selenium and the IE driver as well).
So when Seto Chrome’s capabilities to run on mobile these conditions only apply to the first window thus running my script only in the secondary that remains normal.
Basically my configuration has the following aspect:
require 'rubygems'
require 'capybara/cucumber'
require 'selenium/webdriver'
#Retirando esse register e o default driver eu recebo erro de "rack test requires a rack application"
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
Capybara.default_driver = :chrome
mobile_emulation = { "deviceName" => "Google Nexus 5" }
caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => { "mobileEmulation" => mobile_emulation })
driver = Selenium::WebDriver.for :chrome, :url => "http://localhost:4444/wd/hub", :desired_capabilities => caps
Running with this code inside env.Rb, will probably duplicate the windows. I also noticed that without the line "driver = Selenium::WebDriver.for :chrome ...
" the browser does not duplicate, but does not arrow the mobile settings I would need. Thanks in advance.
Good afternoon! I had a similar problem, when running the script it appeared only "date" in the Chrome url field. But in my case it did not run the script. I decided to update the Chrome driver to see 2.4.1.
– Eduardo Oliveira
Has more data?
– Wellington Avelino