0
votes

Now I use this to run tests. I pass in the command line the name of the browser and the number of help streams. pytest-xdist

def __init__(self, browser):
    desired_capabilites = None
    comand_executor = "http://localhost:4444/wd/hub"

    if browser == "chrome":
        desired_capabilites =  {
                "browserName": "chrome",
                "maxInstances": 5
            }
    elif browser == "firefox":
        desired_capabilites = {
            "browserName": "firefox",
            "maxInstances": 5
        }

    self.driver = webdriver.Remote(
        command_executor=comand_executor,
        desired_capabilities=desired_capabilites)

But this method, it seems to me, has several drawbacks:

  • Before launch, always start * selenium-server * (java -jar selenium-standalone-server.jar) - To test everything in different browsers
  • I have to run tests twice (one for chrome, second for ff)

Is it possible to automate server startup somehow?

And how to run tests in parallel in different browsers?

An excellent option would be to create two nodes and run tests simultaneously in both. Or create several different browsers in one node and launch them already. But I dont know how. Thanks in advance for your help

1

1 Answers

0
votes

There are two ways that you can handle the this.

  1. Get a cloud instance or a server where you can boot up selenium grid and use the server Url to access it. So that you don't need to tare down the server after you are done testing.

  2. If you want to automate the whole setup and tare down process you can use Jenkins and configure Jenkins such a way that you can setup the whole grid before you run the tests and tare down after you are done with it.

If you are using cucumber you can tag the test cases as @Chrome and @FF and when you do the remote browser use if scenario.tagName.equals(Chrome) then run in a node or fire up the remotedriver with chrome capabilities.