Selenium webdriver 如何在SeleniumWebDriver中测试多个浏览器

Selenium webdriver 如何在SeleniumWebDriver中测试多个浏览器,selenium-webdriver,cucumber-junit,Selenium Webdriver,Cucumber Junit,我们正在使用SeleniumWebDriver和Cucumber进行验收测试。我们有一系列需要测试的功能,每个功能都有多个场景,下面是一个示例: Scenario Outline: Unsuccessful login with W3ID credentials Given I navigate to the Bluecost Spreadsheet Upload Web url and receive a login screen When I login using i

我们正在使用SeleniumWebDriver和Cucumber进行验收测试。我们有一系列需要测试的功能,每个功能都有多个场景,下面是一个示例:

  Scenario Outline: Unsuccessful login with W3ID credentials
    Given I navigate to the Bluecost Spreadsheet Upload Web url and receive a login screen 
    When I login using invalid credentials: "<user_id>" and "<user_pwd>"
    Then the W3ID will reject my credentials, produce an error message and I will not proceed to BCSUW

    Examples: 
      | user_id   | user_pwd |
      | baduserid | badpass  |
场景大纲:使用W3ID凭据登录失败
给定我导航到Bluecost电子表格上载Web url并接收登录屏幕
使用无效凭据登录时:“和”
然后W3ID将拒绝我的凭据,并生成一条错误消息,我将不会继续执行BCSUW
示例:
|用户id |用户pwd|
|baduserid | badpass|

我想用我们需要支持的每个浏览器测试这些场景中的每一个:FireFox、Edge和Chrome。如何为这三种浏览器中的每一种运行这些功能和场景?

我已经阅读了上面的帖子链接,其中一个答案适合我:我将为测试中的每一种浏览器执行所有功能/场景。这可能意味着在Firefox、Chrome和Edge中运行测试3次


感谢链接PJAutomator

我是否必须使用在每个场景实例上提供的“browser\u type”变量来编写每个场景?或者有其他方法吗?您应该能够将“browser\u type”作为变量传递给实例化驱动程序并运行相同场景的方法。如果(browser_type.equals(“firefox”){//make instantiate driver for firefox}和类似的其他浏览器。是的,这意味着我必须在“示例”部分对每种浏览器类型重复相同的场景。希望有另一种方法。对于SeleniumWebDriver,您不必有功能文件,但是对于像cucumber这样的BDD,您可以在这里看到类似的问题