Not capturing X path in headless execution

Not finding elements when we run our test script with headless. same script we ran with browser it has ran successfully. Not finding xpaths when we run through headless even though all elements present on DOM. most of the time its failing on 'set text ’ Xpath

1 Like

The most common mistake when running tests with headless browser is, the user forget to set the wiewport size.
By default I think this is set to 800x600 if my memory is still intact.
Note that, attempting to set the window as ‘maximized’ makes no sense in this mode since there is no virtual display present.
So you may have to google a bit about this, there are plenty solutions on www

Another common issue is, in headles mode the tests runs faster compared with a real browser so you may have to use some waits accordingly.

1 Like