简体   繁体   English

如何运行黄瓜方案跨浏览器?

[英]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. 因此,我已经设置了步骤定义和黄瓜方案,并且可以使用firefox正常运行(因为我的step def使用firefox Webdriver),但是现在我需要跨浏览器运行方案。 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. 使用非Firefox的任何浏览器运行WebDriver时,您将需要使用第三方WebDriver。

Use the links Aravin has provided to download the WebDrivers. 使用Aravin提供的链接下载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: 这是在Java中设置新的ChromeDriver实例的示例:

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

IE: 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 对于Chromehttps : //code.google.com/p/selenium/wiki/ChromeDriver

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

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

You can configure this in env.rb file of your project. 您可以在项目的env.rb文件中进行配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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