How to get chrome browser full screen on a VM while executing test?

458 views
Skip to first unread message

testingzeal

unread,
Nov 30, 2015, 1:11:15 PM11/30/15
to webdriver
I am having this issue of browser being not full screen on VMS and causing script failures. I have used this maximize screen and Tool kit and both are not working.

When i login to VM i still see a small browser.


Just an FYI my VM window is full screen but browser is NOT full screen ( I remote desktop to VM thru laptop)


I am talking about CHROME Browser as we run scripts only on CHROME at this point.



here is what i have in code -

Both of them are not working meaning NOT opening browser that fits the screen.

public static WebDriver getChromeBrowser(OperatingSystem os)
throws MalformedURLException {
DesiredCapabilities capability = null;

capability = DesiredCapabilities.chrome();
Toolkit toolkit = Toolkit.getDefaultToolkit();
int Width = (int) toolkit.getScreenSize().getWidth();
int Height = (int)toolkit.getScreenSize().getHeight();
 
ChromeOptions options = new ChromeOptions();
options.addArguments(Arrays.asList("allow-running-insecure-content",
"ignore-certificate-errors"));
capability.setCapability(ChromeOptions.CAPABILITY, options);
capability.setCapability("chrome.switches", Arrays.asList("--incognito"));
capability.setBrowserName("chrome");
// capability.setPlatform(org.openqa.selenium.Platform.VISTA);
RunHost.runHost(capability);
Platform platform = setPlatform(os);
// OS setup
if (platform != null) {
capability.setPlatform(platform);
}
try {
RemoteWebDriver driver = new RemoteWebDriver(new URL(TestProperties
.getInstance().getProperty("hub.host", "")), capability);
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
driver.manage().timeouts().setScriptTimeout(60, TimeUnit.SECONDS);
//driver.manage().window().maximize();
driver.manage().window().setSize(new Dimension(Width,Height));
return driver;

} catch (Exception e) {
e.printStackTrace();
}
return null;
}

Bill

unread,
Nov 30, 2015, 1:33:54 PM11/30/15
to webd...@googlegroups.com
Have you tried ChromeOptions --start-maximized?

Bill
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver.
For more options, visit https://groups.google.com/d/optout.

Moises Siles

unread,
Nov 30, 2015, 2:32:25 PM11/30/15
to Webdriver
As Bill said, you need to start the browser using the --start-maximized, for example

case CHROME:
                    ChromeOptions options = new ChromeOptions();
                    System.setProperty("webdriver.chrome.driver", Constant.vChromeBrowserPath);
                    options.addArguments("--test-type");
                    options.addArguments("--start-maximized");
                    options.addArguments("--lang=en");
                    driver = new ChromeDriver(options);
Reply all
Reply to author
Forward
0 new messages