samedi 29 octobre 2016

Reusing opened browser in Selenium 3

Is it possible to reuse browser? It's really time consuming when selenium is openning new browsers while I'm checking if my tests work.

I'm runinng remotewebdriver on Selenium standalone server. Before the update (without standalone server) I was able to reuse browser by checking if browser is open on specific port:

public void PortSetup()
    {
        DesiredCapabilities firefoxCapabilities = DesiredCapabilities.Firefox();
        try
        {
            var uri = new Uri("http://localhost:7055/hub");
            Driver = new RemoteWebDriver(uri, firefoxCapabilities);
        }
        catch (Exception)
        {
            Driver = new FirefoxDriver(firefoxCapabilities);  
    }

but now browser is opening on different port every time. It would be great if i could specify port, or maybe you have other idea? I have no clue what to do about this so I will appreciate any help.

Aucun commentaire:

Enregistrer un commentaire