- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How could I start a Selenium browser(like Firefox) minimized?
We can start the Selenium browser(like Firefox) in minimized mode. This will be achieved by taking the help of the Dimension class. We shall create an object of this class.
While creating the object , we shall pass the dimensions of the browser size as parameters to the Dimension class. Finally pass the object as parameter to the setSize method.
Syntax
Dimension s = new Dimension(100,200); driver.manage().window().setSize(s);
Example
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.Dimension; public class FirefoxBrwSize{ public static void main(String[] args) { System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe"); WebDriver driver = new FirefoxDriver(); //implicit wait time driver.manage().timeouts().implicitlyWait(8, TimeUnit.SECONDS); //set browser Dimension Dimension s = new Dimension(100,200); //set size to browser driver.manage().window().setSize(s); driver.get("https://www.tutorialspoint.com/index.htm"); // obtain window size System.out.println("Firefox browser size: " + driver. manage().window().getSize()); driver.quit(); } }
Output
Browser window −
- Related Articles
- How to start selenium browser with proxy?
- How to invoke the Firefox browser in Selenium with python?
- How to change Firefox Browser theme?
- Where can I find a definitive Selenium WebDriver to Firefox Compatibility Matrix?
- How to Delete Bookmarks in your Browser (Firefox, Chrome)
- How to hide Firefox window (Selenium WebDriver)?
- How do I set browser width and height in Selenium WebDriver?
- Top Keyboard Shortcuts For Mozilla Firefox Browser
- How to run selenium (Firefox) web driver without a GUI?
- How does Selenium Webdriver handle SSL certificate in Firefox?
- How to set Proxy in Firefox using Selenium WebDriver?
- How to get rid of Firefox logging in Selenium?
- How to perform browser navigations in Selenium?
- How to launch Chrome Browser via Selenium?
- How to maximize the browser in Selenium?

Advertisements