Cucumber - Selenium webdriver(running multiple browser) - Support- env.rb Configuration

200 views
Skip to first unread message

Ifeoma Emodi

unread,
Aug 29, 2017, 10:15:52 AM8/29/17
to Cukes
Hi 


I am new to cucumber and as well as in Ruby, am creating a project in Ruby and this is my folder structure

Feature - Step definition
            - Support - env.rb
            -  Gemfile
            - Gemfile.lock

The issue am facing is where do I specify what browser to be used and if both can run at the same time using the format below

Parameters("browser")

BeforeTest
    public void setup(String browser){
        
    
        if (browser.equalsIgnoreCase("firefox"))
        {
            System.setProperty("webdriver.gecko.driver", "\Users\<name>\Desktop\Automation\Jar\geckodriver.exe");
            driver = new FirefoxDriver();
        
        }
        else if (browser.equalsIgnoreCase("chrome"))
        {
            
            System.setProperty("webdriver.chrome.driver", "\Users\<name>\Desktop\Automation\Jar\chromedriver.exe");
            driver = new ChromeDriver();
        }
        driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
        driver.manage().window().maximize();
    }
Am current using Macbook and am using selenium webdriver with a little bit of Ruby that I have learnt so far. 

I will be grateful if someone can assist me with this 


Thanks 

George Dinwiddie

unread,
Sep 13, 2017, 3:30:41 PM9/13/17
to cu...@googlegroups.com
Ifeoma,

I typically use an environment variable to specify which browser I want
to use. Then my build script can run the tests with each browser I want
to check.

- George
--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------

80Vikram

unread,
Sep 25, 2017, 1:57:00 AM9/25/17
to Cukes
Hi Ifeoma,

I also suggest to search for open source projects in Github.com.

I personally use this technique a lot for learning.

Regards,
Vikram
Reply all
Reply to author
Forward
0 new messages