2

At the moment, it is possible to run the same test on different browser assuming that you have all those browsers installed on your machine and that those browsers have a version compatible with your drivers version.

Is there a way, such as a library or everything else, that allows us to run the same test on different versions of the same browser, downloading those browsers on demand (bit like WebDriverManager does with the drivers)?

We want a test harness runnable on every machine and every operating system and we don't want to rely on any browser already installed in that machine. A tool that allows us to choose on what browser and what version we want to run the test, it downloads a sandboxed or virtual version of that browser, and it runs the test. I heard also about Saucelabs, but the systems under test are not available by publicly available URLs because they are in a dev environment.

I thought we could use Docker, but in that case we have to use a Headless browser, and we want to keep to possibility to see what the test is actually doing.

Thanks in advance.

acejazz
  • 789
  • 1
  • 7
  • 27

1 Answers1

2

No longer do you need (as we did in the dark old days) to manage our own infrastructure and have machines running instances of browsers and configure a Selenium Grid.

SauceLabs is a Selenium Grid in the cloud and is most definitely the recommended approach here. They offer a wide (ever growing) array of platforms.

With all that infrastructure taken care for you in the cloud the problem changes to one of correctly providing SauceLabs the DesiredCapabilities

I would highly recommend you also use Jenkins and its Sauce OnDemand plugin which allows you to select your target environments and at the same time integrate cross device testing into your build pipeline.

Constructing the DesiredCapabilities objects for SauceLabs in your test code is not a straightforward exercise however and can lead to hard to maintain spaghetti code if not done with a lot of discipline.

There are some NuGet packages that solve the SauceLabs DesiredCapabilities problem and integrates with Jenkins as well.

Saucery is DesiredCapability factory for SauceLabs. Full disclosure: I wrote Saucery and maintain it.

Saucery pulls in all the dependencies you would want allowing you to write tests against:

  • Desktop browsers (simply extend SauceryBase)

with Selenium;

or native app tests against:

  • IOS (simply extend SauceryIOSBase); or
  • Android (simply extend SauceryAndroidBase) devices

with Appium.

The home page provides benefits and a How To.

Andrew Gray
  • 3,593
  • 3
  • 35
  • 62