Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Browser not maximizing when running in xvfb #6775

Closed
lukeis opened this issue Mar 4, 2016 · 11 comments
Closed

Browser not maximizing when running in xvfb #6775

lukeis opened this issue Mar 4, 2016 · 11 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 6775

What steps will reproduce the problem?
1. Execute this script file

require 'selenium-webdriver'
display_number = 150
`/usr/bin/Xvfb :#{display_number} -screen 0 1920x1080x24 -ac >/dev/null 2>&1 &`
ENV['DISPLAY'] = ":#{display_number}"
@driver = Selenium::WebDriver.for :firefox
@driver.manage.window.maximize
`import -display localhost:#{display_number} -window root /tmp/firefox_maximize.png`
@driver = Selenium::WebDriver.for :chrome
@driver.manage.window.maximize
`import -display localhost:#{display_number} -window root /tmp/chrome_maximize.png`


What is the expected output? What do you see instead?
On screenshot you can see, that browser maximized, but use different resolution for
maximization, than 1920x1080. Firefox and chrome maximizes in different size windows,
I think size of that windows have something to do with real (non-xvnc) system resolution

Selenium version: selenium-webdriver (2.39.0)
OS: Kubuntu 13.10 x64, Real x server display resolution 1680x1050 + 1280x1024 (Two-Monitor
setup)
Browser:
Firefox 26
Chrome Version 31.0.1650.63, Chromedriver 2.8


Reported by ShockwaveNN on 2013-12-26 12:36:32


- _Attachment: chrome_maximize.png
![chrome_maximize.png](https://storage.googleapis.com/google-code-attachments/selenium/issue-6775/comment-0/chrome_maximize.png)_ - _Attachment: firefox_maximize.png
![firefox_maximize.png](https://storage.googleapis.com/google-code-attachments/selenium/issue-6775/comment-0/firefox_maximize.png)_
@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Mispell: in expected output should read 
"I think size of that windows have something to do with real (non-xvfb) system resolution"

Reported by ShockwaveNN on 2013-12-26 12:40:00

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2013-12-27 09:56:27

  • Labels added: OpSys-Linux

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by jmleyba on 2013-12-30 04:01:42

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

You need to install a window manager for maximization to work.

Reported by jari.bakken on 2014-01-02 22:14:56

  • Status changed: WontFix
  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

This is a actual bug. xvfb is a window manager!
I tried it with php (Behat) and sounds like the window will just keep the size is was
set (on start on with browser resize).
Please take a look at https://github.com/Behat/MinkSelenium2Driver/issues/131 to see
a real world problem.
Usually xvfb will be used on Continous Integration environments to keep a light and
flexible setup.

Reported by handrus on 2014-05-05 17:47:54

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

setSize works: 
driver.manage().window().setSize(1920, 1080);

Reported by adementev on 2015-01-12 14:01:16

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Is there a reason why this is marked as won't fix?
It is thecnically impossible?

Reported by handrus@taller.net.br on 2015-01-12 14:05:20

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Maybe it will not be fixed because it is Xvfb-related problem? Try starting a browser
manually from command line and see what size it will have... the same as one started
by Selenium, so it is not a Selenium-related problem.

.setSize() did the trick for me, thanks ademen!

Reported by bartlomiej.tofel@nextwebmedia.pl on 2015-04-01 19:38:53

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Wouldn't it be possible to detect the resolution and use setSize to it?

Reported by handrus@taller.net.br on 2015-04-05 19:48:34

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

For ruby's selenium lib (which I believe the OP is using) setSize doesn't work. You
need to use driver.manage.window.resize_to(1920, 1080)

Reported by kylee.tilley on 2015-04-22 19:42:55

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:21:53

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant