Reputation: 1144
@angular/cli 7.3.9
protractor 5.4.0
karma 4.0.0
How do protractor
's browser
method get
takes url parameters query ?
browser.get('${browser.baseUrl}?p=2')
is redirecting to http://localhost:4200/&p=2
instead of http://localhost:4200&p=2
.
When i supress last character of browser.baseUrl
, the redirected url is http://localhost:420/&p=2
...
Any idea ?
I tried edit protractor.conf.js
by adding baseUrl
but i does not change anything ...
Upvotes: 1
Views: 389
Reputation: 8672
If you set a baseUrl
in the config file, then there is no need to add browser.baseUrl
in the get method, you can omit it.
For instance, in the config you have:
exports.config = {
// ...
baseUrl: 'https://github.com/search',
}
In the test, you can just add the query parameters like this:
it('should open the URL with the query parameter', async () => {
await browser.get('?q=test'); // will open the 'https://github.com/search?q=test' page
});
Upvotes: 1