How to configure env.rb to start portable chrome (instead of local installation) with Ruby, Selenium and LapisLazuli

429 Views Asked by At

Question:

For my Test Automation Suite I would like to know how to configure/setup my portable Chrome to run instead of the local installed Chrome.

Reason:

There is an issue with the application I'm trying to test and Chrome Version 55. Issue: Certain buttons are since this version not clickable and I want to bypass this for the time being by using an older Chrome version.

I use Ruby version 2.3.0p0 (2015-12-25 revision 53290)
And LapisLazuli as described on www.testautomation.info
The setup itself is working. The answer might be simple, but I did not manage to get this running in this combination.
I found information about selenium/Java, but I have no idea how to get that to work with my setup. Selenium not starting portable chrome but local installation
I also found this website: https://leanpub.com/watirbook/read And here they mentioned the following:

3 > require "selenium-webdriver" 4 => true 5 6 > Selenium::WebDriver::Chrome.path = 7 'C:\chrome\chrome.exe' 8 => "C:\\chrome\\chrome.exe"

So I tried that in irb and this worked

require 'lapis_lazuli' include LapisLazuli Selenium::WebDriver::Chrome.path = 'C:\chrome_portable_v53\chrome.exe' browser :chrome

The portable chrome version was started. Now I only need to know how to place this in my env.rb file (I assume), which looks currently like this:

require 'lapis_lazuli' require 'lapis_lazuli/cucumber' LapisLazuli::WorldModule::Config.config_file = "config/config.yml" World(LapisLazuli)

1

There are 1 best solutions below

0
On

I think the following is answering the question. I've added require selenium-webdriver and that Chrome.path to the env.rb and this seems to work.

require 'lapis_lazuli'
require 'lapis_lazuli/cucumber'
require 'selenium-webdriver'

Selenium::WebDriver::Chrome.path = 'C:\chrome_portable_v53\chrome.exe'
LapisLazuli::WorldModule::Config.config_file = "config/config.yml"

World(LapisLazuli)