What are the options we have to maximize our application using Selenium
|Motivating others to maximize their learning by sharing more.|
Note:- Above image may look irrelevant as per the topic, but it is to motivate ppl to unleash their hidden potential,maximize learning and share more like a colorful nature which shares freshness and happiness with us.Please share your views as comments.
Using maximize() command
This is one of the recommended methodology, but works for webdriver version >2.21
Toolkit utility(Java Library)
It considers the maximization of the browser window as per the current resolution of the system.It queries the native operating system directly and is platform independent.Fetch the screenresolution of the system that we can use in “setsize” method.What is AWT toolkit.
Toolkit toolkit = Toolkit.getDefaultToolkit();
int Width = (int) toolkit.getScreenSize().getWidth();
int Height = (int)toolkit.getScreenSize().getHeight();
Dimension screenResolution = new Dimension(Width,Height); driver.manage().window().setSize(screenResolution);
Using Sendkeys IF nothing works out “SendKeys” is our best buddy.
What is WebDriverBackedSelenium?
This object is provided for backwards compatibility. It allows those who have existing test suites using the Selenium-RC API to use WebDriver under the covers. It’s provided to help ease the migration path to Selenium-Web driver.We can use this object to create our tests with Selenium Remote Control syntax. Remember we don’t need to start the selenium server to work with this.
For browser maximization we will simply use the windowMaximize method of selenium RC in webdriver.
1.We can Resize browser window or Customize browser window size
we can use SetSize method (approach2)
3.In chrome we can use “–start-maximized” in chrome options to maximize window.