driver.manager().getSize() return (768, 548), which is too small

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

driver.manager().getSize() return (768, 548), which is too small

Reed Xia
Hi there,

My project is Selenium Webdriver + Jenkins, and it is running on Slave node(Ubuntu 14.04) with Xvfb( Xvfb screen is set to 1024x768x24) and Firefox 40.

I add the statement "driver.manager().getSize()" and it returns (768, 548), which is too small.

Is it a normal case?(while the resolution 768 * 548 is correct when Xvfb set to 1024x768x24)

And could someone share how to set a bigger resolution for the browser running?

Thanks,
Reed

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAB_-H09E2k1n9yEm5h0QP4TYB5k0z_0K8kdxeWVRPZsK8FaCYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: driver.manager().getSize() return (768, 548), which is too small

Jonathan Herbaut
Hi,
It's normal to have a lower size of your browser when you use GetSize. Depending on your browser, the GetSize will return the area of your html render and not the size of your window. The browser has toolbars that eat the height of the page.
But the width is the most of the time the same than the one you requires.
Can you see your firefox running ? You will quickly understand why your GetSize is so low.

To set the size, you just need to write the property remote.Manage().Window.Size where remote is your remoteWebDriver.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0d04aa3a-2663-4802-84cb-8ab3f6945e9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: driver.manager().getSize() return (768, 548), which is too small

Reed Xia
Hi Jonathan,

Thanks for the reply and your suggestion! I can't see Firefox running because our team setup Xvfb to run the Selenium tests in a headless way.

I added  "driver.manage().window().setSize(new Dimension(1024, 768))" and now the problem is resolved.

Thanks,
Reed


On Tue, May 15, 2018 at 5:45 PM, Jonathan Herbaut <[hidden email]> wrote:
Hi,
It's normal to have a lower size of your browser when you use GetSize. Depending on your browser, the GetSize will return the area of your html render and not the size of your window. The browser has toolbars that eat the height of the page.
But the width is the most of the time the same than the one you requires.
Can you see your firefox running ? You will quickly understand why your GetSize is so low.

To set the size, you just need to write the property remote.Manage().Window.Size where remote is your remoteWebDriver.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0d04aa3a-2663-4802-84cb-8ab3f6945e9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAB_-H084ecXvAV-h0x6odUq2pTVTuqhBesyK%3Du_h1-KBWGzOwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.