Skip to content

Commit

Permalink
Fixes/new headless mode in chrome (#3581)
Browse files Browse the repository at this point in the history
  • Loading branch information
gravityvi committed Jan 30, 2023
1 parent 286aca0 commit 91e113f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/transport/selenium-webdriver/options.js
Expand Up @@ -328,7 +328,7 @@ module.exports = class SeleniumCapabilities {

addHeadlessOption({options}) {
if (this.argv.headless && (options instanceof Capabilities) && (this.isChrome || options.headless)) {
this.isChrome ? options.addArguments('headless=chrome') : options.headless();
this.isChrome ? options.addArguments('headless=new') : options.headless();
}

return this;
Expand Down
2 changes: 1 addition & 1 deletion test/lib/command-mocks.js
Expand Up @@ -385,7 +385,7 @@ module.exports = {
url = '/wd/hub/session'
}) {
const browserName = 'chrome';
const headlessOpt = headless ? 'headless=chrome' : '';
const headlessOpt = headless ? 'headless=new' : '';
const options = {
['goog:chromeOptions']: {}
};
Expand Down
4 changes: 2 additions & 2 deletions test/src/core/testCreateSession.js
Expand Up @@ -198,7 +198,7 @@ describe('test Request With Credentials', function () {
sessionId: '1352110219202',
capabilities: {browserName: 'chrome', version: 'TEST', platform: 'TEST'}
});
assert.deepStrictEqual(sessionOptions.get('goog:chromeOptions'), {args: ['headless=chrome']});
assert.deepStrictEqual(sessionOptions.get('goog:chromeOptions'), {args: ['headless=new']});
});

it('Test create session with headless mode in Edge', async function () {
Expand Down Expand Up @@ -287,7 +287,7 @@ describe('test Request With Credentials', function () {
assert.deepStrictEqual(sessionOptions.get('goog:chromeOptions'), {
args: [
'--no-sandbox',
'headless=chrome'
'headless=new'
]
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/src/index/transport/testChromeOptions.js
Expand Up @@ -108,7 +108,7 @@ describe('Test chrome options', function () {
const options = client.transport.createSessionOptions({headless: true});

assert.strictEqual(options instanceof ChromeOptions, true);
assert.deepStrictEqual(options.options_.args, ['headless=chrome']);
assert.deepStrictEqual(options.options_.args, ['headless=new']);
});

it('devtools cli arg', function(){
Expand Down

0 comments on commit 91e113f

Please sign in to comment.