Resize Broser in Headless mode

Best practices, code snippets for common functionality, examples, and guidelines.
Pamana
Posts: 4
Joined: Thu May 17, 2018 9:13 am

Resize Broser in Headless mode

Post by Pamana » Tue May 22, 2018 5:22 pm

Hello,

I'm trying to validate Screenshots in Headless mode. I use an endpoint with the configuration:

capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['headless', 'window-size=1920,1080']
}
}

When opening the browser without the "headless" argument the window-size is as desired. But If I open the browser headless the screenshots dosen't match anymore. It seems like the headless browser is not using the window-size I configured.

Is there any way to validate the screenshots in headless mode or set the browser size?

Many thanks

Pamana
Posts: 4
Joined: Thu May 17, 2018 9:13 am

Re: Resize Broser in Headless mode

Post by Pamana » Wed May 23, 2018 5:08 pm

Update:
Actually window-size is working. However screenshots differ depending on running headless or not.

I fixed the problem by taking the screenshots for validation with the headless browser.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Resize Broser in Headless mode

Post by Support Team » Fri Aug 03, 2018 7:51 am

Test post
.
Image