Brine
Brine

Reputation: 3731

Protractor: How to get the baseUrl passed from the command line?

I'm looking for a way to get access to the baseUrl I've passed via the command line. Eg.

protractor conf.js --baseUrl=http://myawesomesite.com 

I've tried browser.baseUrl returns me the baseUrl set in my conf.js, but seemingly not the one passed from the command line.

Upvotes: 3

Views: 1501

Answers (3)

Brine
Brine

Reputation: 3731

browser.baseUrl IS the way to get the baseUrl...

The reason I thought there might be a different way to get the command line baseUrl, was because my tests were failing on browserstack. It was either ignoring the baseUrl passed from the command line, and using the default in the config. Removing the default in the config, then failed because it was blank.

Not sure what the solution for this is... because it just started working again. Could have been caching (though I don't know where), or perhaps Jasmine2 (since the issue was called in a BeforeAll block)?

Anyway, wanted to update this and thank the answerers for their help!

Upvotes: 3

Sergey Teplyakov
Sergey Teplyakov

Reputation: 610

I do not see your conf.js, but if you have somehting like this:

params: {
        screenWidth: 1920,
        screenHeight: 1080,
    }

In this case it should be done this way:

protractor conf.js --params.screenWidth=1024

Upvotes: 0

Rahul Vig
Rahul Vig

Reputation: 736

Use- protractor conf.js --baseUrl http://myawesomesite.com

Upvotes: 0

Related Questions