The dimensions of the Ruby Headless screen are not respected

I am running Watir test using Ruby and Watir-Webdriver and headless stone.

Here is the code that sets up the headless environment:

headless = "1600x900x24")


If a test fails, our test environment will automatically capture a screenshot. I expected to see screenshots that were 1600x900, but the images are around 1050 x 818 (+/- a few pixels) and the web pages themselves are scaled to fit that area.

I resized the voiceless dimensions to 3200x1800x24 and my screenshot was 1585 x 1718. I changed the voiceless dimensions to 50x90x24 and the screenshot was 187 x 8, in which case the entire web page was not visible.

Any explanation for this behavior? How do I set a headless screen to 1600 x 900? I'm wondering if this is an issue with Xvfb, or how Headless works with Xvfb, but I don't know much about how it works, and the reading I did on Xvfb today didn't cover anything for me.

It's less screen shots that I care about and more page scaling to fit the scaled down 1050 x 818 dimensions. At this size, some of the page elements for the test I'm writing are wrapped on the screen rather than clickable, which causes the test to fail in first of all.


source to share

1 answer

Previously, I had a problem with a headless Jenkins server. The problem was in Xvfb. You can set the screen resolution on the command line, for example:

Xvfb :1 -screen 0 1600x900x24




All Articles