Uni VPS
Uni VPS

Reputation: 99

ChromeDriver window doesn't readjust the size to fit Nexus 5's dimensions

I'm currently using:

options.EnableMobileEmulation("Nexus 5");

To emulate a mobile version of a website, but ChromeDriver window doesn't readjust the size to fit Nexus 5's dimensions so I'm left with half a blank page.

Example:

enter image description here

I want window size to fit the content of the site rather than producing empty page content.

Upvotes: 3

Views: 171

Answers (1)

Ratmir Asanov
Ratmir Asanov

Reputation: 6459

Try the following code:

System.Drawing.Size window_size = new System.Drawing.Size(x, y);
driver.Manage().Window.Size = window_size;

where x, y: width and height in pixels.

Hope it helps you!

Upvotes: 3

Related Questions