简体   繁体   中英

How can I run cucumber scenarios crossbrowser?

so I have set up my step definitions and cucumber scenarios and they r running fine using firefox (since my step def are using firefox webdriver) but now I need to run my scenarios crossbrowser. I have been looking at selenium grid as an option but would greatly appreciate if someone can guide me on how to run my cucumber scenarios crossbrowser. thanks

When running WebDriver using any browser that is not Firefox you will need to use a third-party WebDriver.

Use the links Aravin has provided to download the WebDrivers.

You will also need to set a system property to where the third party driver files are located.

Here's an example of setting up a new ChromeDriver instance in Java:

System.setProperty("webdriver.chrome.driver", "path/to/chromedriver.exe");
WebDriver driver = new ChromeDriver();

IE:

System.setProperty("webdriver.ie.driver",  "path/to/iedriver.exe");
WebDriver = new InternetExplorerDriver();

This should set you up a local instance for the above browsers.

If you are thinking of using grid, you can find plenty of info in the docs

You have to use the corresponding driver for the browser to execute your scenario.

For Chrome : https://code.google.com/p/selenium/wiki/ChromeDriver

For IE : https://code.google.com/p/selenium/wiki/InternetExplorerDriver

For Safari : https://code.google.com/p/selenium/wiki/SafariDriver

You can configure this in env.rb file of your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM