Reputation: 421
How do we maximize a firefox browser using Selenium WebDriver (Selenium 2) with node.js. I am using wd
package for Selenium WebDriver to write the tests. I have tried executing window.resizeTo(1366,768);
usin eval
or execute
but didn't work.
I am using Selenium WebDriver 2.25.0
Upvotes: 39
Views: 116412
Reputation: 98881
As of 2020, the correct answer is :
driver.maximize_window()
Upvotes: 2
Reputation: 436
Use this code:
driver.manage().window().maximize()
works well,
Please make sure that you give enough time for the window to load before you declare this statement.
If you are finding any element to input some data then provide reasonable delay between this and the input statement.
Upvotes: 6
Reputation: 241
One way, everyone already have written in thier answers:
driver.manage().window().maximize()
but if you looking for alternative ways, here you are:
driver.manage().window().setSize(screenResolution);
or
driver.findElement(By.id("......")).sendKeys(Keys.F11);
Upvotes: 1
Reputation: 949
Try this:
self.ff_driver = Firefox()
self.ff_driver.maximize_window()
Upvotes: 1
Reputation: 301
driver.manage().window().maximize() ;
works perfectly and at the very beginning it maximizes the window. Does not wait to load any page.
Upvotes: 0
Reputation: 99
First instantiate a firefox driver
WebDriver driver = new FirefoxDriver();
then maximize it
driver.manage().window().maximize();
Upvotes: 9
Reputation: 11
The statement :: driver.manage().window.maximize();
Works perfectly, but the window maximizes only after loading the page on browser, it does not maximizes at the time of initializing the browser.
here : (driver) is called object of Firefox driver, it may be any thing depending on the initializing of Firefox object by you only.
Upvotes: 1
Reputation: 103
Try this working for Firefox:
driver.manage().window.maximize();
Upvotes: 2
Reputation: 13850
If you are using Selenium WebdriverJS than the below code should work:
var window = new webdriver.WebDriver.Window(driver);
window.maximize();
Upvotes: 1