Maximization of a web browser through the Web Driver (Python selenium) is very easy. In short, all you have you have to do is start the browser and call the maximize_window().
(Selenium is a Python module that uses a web driver to control a web browser for you)
Related course:
selenium
selenium maximize
Before you start, make sure you have the right Web Driver installed for your Web Browser. For Firefox that’s GeckoDriver, For Chrome that’s ChromeDriver and so on.
Besides installing the Web Driver, you need to install the Python selenium module. The selenium module can be installed using the operating systems package manager or pip.
The example below opens the web browser and maximizes it. This is done in a few steps.
1 | from selenium import webdriver |
First import webdriver and the time module. These are required for interacting with the Web Driver.
1 | from selenium import webdriver |
Then open your web browser, for instance, firefox with webdriver.Firefox()
and maximize the window with the call maximize_window().
1 | driver = webdriver.Firefox() |
If you are new to selenium, then I highly recommend this book.