Below example shows how we can close the browser window in java using selenium web driver
WebDriver driver = new FirefoxDriver();
driver.close();
driver.quit();
Please note that same code will work on all other browsers like chrome, safari and IE. Notice that same code can be used to close the tabs as well. A tab in browser is considered as a new browser window in Selenium.
You may also like to read below topics.
What do you think on above selenium topic. Please provide your inputs and comments. Thanks
WebDriver driver = new FirefoxDriver();
driver.close();
driver.quit();
Please note that same code will work on all other browsers like chrome, safari and IE. Notice that same code can be used to close the tabs as well. A tab in browser is considered as a new browser window in Selenium.
You may also like to read below topics.
- Press key in Selenium Webdriver in Java
- Read Table Data in Selenium Webdriver in Java
- Take the screenshot in Selenium Webdriver in Java
- Execute JavaScript in Selenium Webdriver in Java
- Handle multiple browser windows in Selenium Webdriver in Java
- Double-Click on the Element in Selenium Webdriver in Java
- Exceptions in Selenium Webdriver in Java
- Synchronization in Selenium Webdriver in Java
No comments:
Post a Comment