Best Practice Headless Web Driver

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

Best Practice Headless Web Driver

Post by Pamana » Tue May 22, 2018 10:29 am


I'm want to automate our web testing setup and have a general question for my setup.

I want to test our test cases against different browsers with different browser sizes. As the test will run in Jenkins on a machine without graphical interface I need to use headless browsers for chrome and firefox.

I set an endpoint for chrome using:

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

Can i use different configurations when starting the ".exe"? Or do I use a different approach?

Or do I write a custom function and pass the arguments i.e.:
Host.Current.OpenBrowser(pageUrl," 'headless', 'window-size=1920,1080' ",false,true,false,false,false);
(However, the arguments are not used, when starting the browser on an endpoint).

Thanks for your help.

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

Re: Best Practice Headless Web Driver

Post by Support Team » Tue Jun 12, 2018 7:21 am

Hello Pamana,

Thank you for your post.

You could use the commandline argument "/endpointconfig:<Configuration Name>" for starting your test with a specific endpoint configuration.
As an example, the whole command would look like this:

Code: Select all

MyTest.exe /endpoint:MyEndpoint /endpointconfig:MySpecificConfiguration
I hope, this information is helpful.