Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference running Protractor with/without Selenium?

Checking the protractor documentation, I see there is a option to run protractor without using Selenium server using directConnect: true flag.

What is the difference between running protractor tests with a selenium server and without a selenium server other than the fact that only Chrome, Firefox are supported for the latter case?

like image 831
meteor Avatar asked Jun 02 '15 15:06

meteor


People also ask

Can we use Protractor without selenium?

Protractor can test directly, without the use of Selenium Server, against Chrome and Firefox by setting directConnect: true in config file.

Does Protractor use selenium?

Protractor is a wrapper around Selenium Webdriver that provides an automation test framework, which simulates user interaction with an Angular web application for a range of browsers and mobile devices. It provides all features of Selenium WebDriver along with Angular specific features for seamless end to end testing.

How do you run a Protractor test in multiple browsers?

Testing Against Multiple Browsers If you would like to test against multiple browsers, use the multiCapabilities configuration option. Protractor will run tests in parallel against each set of capabilities. Please note that if multiCapabilities is defined, the runner will ignore the capabilities configuration.


1 Answers

First of all, currently, you have 5 different built-in options/ways to connect to browser drivers:

  1. specify seleniumServerJar to start selenium standalone server locally
  2. specify seleniumAddress to connect to a running selenium server (local or remote)
  3. set sauceUser and sauceKey to connect to Sauce Labs remote selenium server
  4. set browserstackUser and browserstackKey to use remote Selenium Servers via BrowserStack
  5. use directConnect to connect to Chrome or Firefox directly. There are additional chromeDriver and firefoxPath setting that you can use to define custom Chrome driver and Firefox application binary locations.

The first 4 options basically work through a "proxy", a selenium server:

The server acts as proxy between your test script (written with the WebDriver API) and the browser driver (controlled by the WebDriver protocols). The server forwards commands from your script to the driver and returns responses from the driver to your script.

The main reason to automate browsers through an intermediate selenium server as opposed to direct webdriver connect is that selenium server, if acts as a Selenium Grid, allows you to expand/scale your tests across multiple browsers, multiple browsers on multiple systems, see, for instance, Sauce Labs Selenium Grid. FYI, there is also BrowserStack service, that, apart of other features, acts as a selenium server with, similarly to Sauce Labs, enormous amount of different capabilities/configurations - browsers and systems.

The other use case of starting up a selenium server (speaking about option 2) and not using directConnect is that you may have a specific configuration(s) you want your tests to run on. Say, you have a Windows machine with IE 11 on board and Ubuntu with Firefox 35. In this case, you may configure these machines as selenium nodes which would connect to a selenium server/hub.

If you are running your tests locally and your target browsers are Chrome or/and Firefox, use directConnect, your tests would run faster.

But, if you are running your tests locally and need to test against IE, Safari or other browsers, you'd go with options 1-4 (usually 1), since these browsers cannot work in "direct connect" mode.

See also related topics:

  • What are the differences between 'Selenium-server-standalone.jar' and 'Selenium Client & WebDriver'?
  • Difference between "selenium server" and "selenium server standalone" jars
like image 161
alecxe Avatar answered Sep 21 '22 02:09

alecxe