4

I am using:

driver.manage().window().maximize();

to maximize the chrome screen, but it is not working and give me a message:

this statement is not getting executed. version of chrome is:Version 62.0.3202.75 (Official Build) (64-bit)

Can anybody help me to solve the issue.

4b0
  • 20,627
  • 30
  • 92
  • 137
joy
  • 111
  • 1
  • 3
  • 8

7 Answers7

4

If you need the window to start maximised at launch, use the below code.

System.setProperty("webdriver.chrome.driver",prop.getProperty("driverpath"));
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--start-maximized");
WebDriver driver= new ChromeDriver(chromeOptions);
njosep
  • 380
  • 2
  • 13
3

it worked for me -

driver.manage().window().fullscreen();
Hassan Imam
  • 20,493
  • 5
  • 36
  • 47
2

I replace

driver.manage().window().maximize();

with

driver.manage().window().fullscreen();

and it works for me, I am using chrome driver 2.35 on Mac

Hassan Imam
  • 20,493
  • 5
  • 36
  • 47
0

I have same problem previously, after updating chrmedriver with 2.33 Version resolve the issue, Let a try and let me know

Please download chromedriver 2.33 from this link

iamsankalp89
  • 4,363
  • 2
  • 13
  • 35
0

Just look selenoid guide: http://aerokube.com/selenoid/latest/#_custom_screen_resolution_screenresolution. I faced this this issue and founded solution:

 @WhenPageOpens
public void maximiseScreen()
{
    getDriver().manage().window().setSize(new Dimension(2560,1440));
}

@WhenPageOpens is Serenity annotation

Relink
  • 1
-1
String filePath = System.getProperty("user.dir") + "\\libs\\chromedriver.exe";

System.setProperty("webdriver.chrome.driver", filePath);

ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
options.addArguments("--disable-notifications");
options.addArguments("--disable-extenstions");
options.addArguments("disable-infobars");
WebDriver driver = new ChromeDriver(options);
-1

Please use below code for maximize chrome browser.

DesiredCapabilities capability = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();            
options.addArguments(
                Arrays.asList("--start-maximized", "allow-running-insecure-content", "ignore-certificate-errors"));
capability.setCapability(ChromeOptions.CAPABILITY, options);

capability.setBrowserName("chrome");
WebDriver driver= new ChromeDriver(options);