Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/helper/Puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ class Puppeteer extends Helper {
if (!page) return;
page.setDefaultNavigationTimeout(this.options.getPageTimeout);
this.context = await this.page.$('body');
if (this.config.browser === 'chrome') {
if (this.options.browser === 'chrome') {
await page.bringToFront();
}
}
Expand Down Expand Up @@ -658,9 +658,9 @@ class Puppeteer extends Helper {
url = this.options.url + url;
}

if (this.config.basicAuth && (this.isAuthenticated !== true)) {
if (this.options.basicAuth && (this.isAuthenticated !== true)) {
if (url.includes(this.options.url)) {
await this.page.authenticate(this.config.basicAuth);
await this.page.authenticate(this.options.basicAuth);
this.isAuthenticated = true;
}
}
Expand Down
5 changes: 4 additions & 1 deletion lib/helper/REST.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ class REST extends Helper {
this.options.maxBodyLength = maxContentLength;
}

this.options = { ...this.options, ...config };
// override defaults with config
this._setConfig(config);

this.headers = { ...this.options.defaultHeaders };
this.axios = axios.create();
// @ts-ignore
this.axios.defaults.headers = this.options.defaultHeaders;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/helper/WebDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,12 +977,12 @@ class WebDriver extends Helper {
*/
amOnPage(url) {
let split_url;
if (this.config.basicAuth) {
if (this.options.basicAuth) {
if (url.startsWith('/')) {
url = this.config.url + url;
url = this.options.url + url;
}
split_url = url.split('//');
url = `${split_url[0]}//${this.config.basicAuth.username}:${this.config.basicAuth.password}@${split_url[1]}`;
url = `${split_url[0]}//${this.options.basicAuth.username}:${this.options.basicAuth.password}@${split_url[1]}`;
}
return this.browser.url(url);
}
Expand Down