How to run Selenium tests in multiple browsers for cross-browser testing using Java?

前端 未结 4 1841
青春惊慌失措
青春惊慌失措 2020-12-06 08:37

I am using Selenium WebDriver with Java & TestNG framework. I want to use Firefox, IE, Chrome in one single code at a time for doing cross-browser testing. I can only in

4条回答
  •  不思量自难忘°
    2020-12-06 09:03

    For Ruby you can do the following if you want to run your single code in all three browsers one after the other:

    def all_browsers
      browsers = [:firefox,:ie,:chrome].each do |br|
      $driver = Selenium::WebDriver.for br
      $driver.manage.window.maximize
      $driver.navigate.to("http://google.com")
    end
    

提交回复
热议问题