{"id":23364,"date":"2019-07-17T06:18:03","date_gmt":"2019-07-17T06:18:03","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=23364"},"modified":"2025-05-17T07:15:55","modified_gmt":"2025-05-17T07:15:55","slug":"command-to-close-the-current-browser-window-in-selenium-webdriver","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/command-to-close-the-current-browser-window-in-selenium-webdriver\/","title":{"rendered":"Command to close the current browser window in Selenium WebDriver?"},"content":{"rendered":"<h2>Command to close the current browser window in Selenium WebDriver?<\/h2>\n<p>a. driver.quit()<\/p>\n<p>b. driver.close()<\/p>\n<p>c. driver.stop()<\/p>\n<p>d. driver.exit()<\/p>\n<h2>Correct Answer<\/h2>\n<p>b. driver.close()<\/p>\n<h2>Explanation<\/h2>\n<p>The <em>driver.close()<\/em> command closes the current browser window that the WebDriver is controlling. If multiple windows are open, it will only close the one currently in focus.<\/p>\n<p>The <em>driver.quit()<\/em> command, on the other hand, closes all browser windows and ends the WebDriver session.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Command to close the current browser window in Selenium WebDriver?<br \/>\na. driver.quit()<br \/>\nb. driver.close()<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[185],"tags":[],"class_list":["post-23364","post","type-post","status-publish","format-standard","hentry","category-selenium","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/23364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=23364"}],"version-history":[{"count":5,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/23364\/revisions"}],"predecessor-version":[{"id":27417,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/23364\/revisions\/27417"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=23364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=23364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=23364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}