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.
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;
}