Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is `webdriver-manager start` necessary?

I'm delving into the world of Protractor tests for AngularJS.

All the tutorials recommend I execute the following after webdriver-manager update and prior to executing the test: webdriver-manager start

According to the webdriver-manager man, the start command will 'start up the selenium server'. True enough, once I run the above command, I can see something at http://127.0.0.1:4444/wd/hub

My questions is: is the above necessary?

I currently run my tests without the above command.

All I do is: webdriver-manager update php -S localhost:8000 -t dist/ protractor ./test/protractor.config.js

My tests run as expected even though I've excluded webdriver-manager start.

Can someone please explain why webdriver-manager start is necessary?

:EDIT:

My protractor/fooTests.js:

exports.config = {
    directConnect: true,
    capabilities: {
        'browserName': 'chrome'
    },
    specs: ['protractor/fooTests.js'],
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000
    }
};

My protractor/fooTests.js:

describe('test for the bar code', function() {
    it('should login', function() {
        browser.get('http://localhost:8000');

        element(by.model('password')).sendKeys('123456');
        element(by.css('[type="submit"]')).click();
    });
    it('should inspect element ', function() {
        expect(element(by.id('foo-script')).isPresent()).toBe(true);
        console.log('Login Success');
    });
});
like image 650
Housni Avatar asked Oct 20 '22 11:10

Housni


1 Answers

Protractor is sending commands to Selenium and Selenium is communicating with the browsers using its drivers.

webdriver-manager start

is starting Selenium.

There are 3 basic options:

  1. directConnect. That makes protractor communicate with the selenium drivers directly, without using the Selenium server. However, the functionality of this option is limited:

directConnect: true - Your test script communicates directly Chrome Driver or Firefox Driver, bypassing any Selenium Server. If this is true, settings for seleniumAddress and seleniumServerJar will be ignored. If you attempt to use a browser other than Chrome or Firefox an error will be thrown.

  1. Connecting to an already running selenium server (either local or remote), specified by seleniumAddress. A server can be started using the webdriver-manager start script.

  2. Starting the server from the test script.

You can explore all the options in the documentation https://github.com/angular/protractor/blob/master/docs/server-setup.md

like image 122
Sulthan Avatar answered Oct 22 '22 03:10

Sulthan