0

I have some scripts which are running on Firefox browser. Here the problem was I am using driver.manage().window().maximize(); code to maximize the browser. It is perfectly working fine with Windows 7 environment but coming to Windows 10 environment after browser opening window is set to some small size not sure why it is happening !

Please help me on this

NOTE : I am using latest firefox driver(gecko) and latest version of firefox browser.(In both Windows 7 and windows 10)

  • I'm using the same - Win 1o and FF - version 56 but haven't faced this issue. – demouser123 Nov 7 '17 at 3:14
0

That's a weird one but try:

((FirefoxDriver)driver).getKeyboard().pressKey(Keys.F11);

Also, I'm assuming this doesn't work:

driver.manage().window().setSize(new Dimension(1024, 768));
0

Not sure why that would happen in Win10 (same thing works for me) but couple of things you could try, depending on what you need:

  1. Add width and height options to the Firefox initialisation set to the screen resolution you need it to open as.
  2. Also run it headless with those dimensions set (as do you need to see the browser if it's running in the background?)
System.setProperty("webdriver.gecko.driver", locationFirefoxDriver);
FirefoxBinary firefoxBinary = new FirefoxBinary();
firefoxBinary.addCommandLineOptions("--headless");
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.addArguments("--width=1920");
firefoxOptions.addArguments("--height=1080");
firefoxOptions.setBinary(firefoxBinary);
driver = new FirefoxDriver(firefoxOptions);

Although I can understand not bothering with Headless and Firefox. Chrome you get about 30% speed improvement, Firefox I'm not sure it's even 3%.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.