{"id":4618,"date":"2021-07-15T04:29:44","date_gmt":"2021-07-15T04:29:44","guid":{"rendered":"https:\/\/studysection.com\/blog\/?p=4618"},"modified":"2021-07-15T06:29:56","modified_gmt":"2021-07-15T06:29:56","slug":"selenium-webdrivermanager","status":"publish","type":"post","link":"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/","title":{"rendered":"Selenium WebDriverManager"},"content":{"rendered":"<p>WebDriverManager is a class that downloads and sets the browser\u2019s driver binaries automatically like chromedriver.exe, geckodriver.exe, and edgedriver.exe, etc required by Selenium WebDriver API. <\/p>\n<p>Usually, to automate web applications we need to download browser driver executables manually for required browsers. Once driver executables are downloaded into the local system then we need to place them in a specific path and set the path for driver executables that becomes a very time-consuming and boring task to maintain driver executables and when browser version changes. If the path is not defined in the script or provides the wrong path, It will throw an exception.<\/p>\n<p><strong><em>&#8220;The path to the driver executable must be set by the webdriver.chrome.driver system property&#8221;.<\/em><\/strong><\/p>\n<h2>Here is an example to set the path for driver executables traditionally in Selenium:?<\/h2>\n<p><code>System.setProperty(\"webdriver.chrome.driver\", \"\/path\/to\/chromedriver\");<br \/>\nSystem.setProperty(\"webdriver.gecko.driver\",\"\/path\/to\/geckodriver\");<\/code><\/p>\n<p>This problem can be resolved by using WebDriverManager for different browsers. It provides some driver managers for these browsers(Chrome, Firefox, Edge, Opera, and Internet Explorer).<\/br><br \/>\n<strong>These can be used as follow:<\/strong><br \/>\n<code>WebDriverManager.chromedriver().setup();<br \/>\nWebDriverManager.firefoxdriver().setup();<br \/>\nWebDriverManager.edgedriver().setup();<br \/>\nWebDriverManager.operadriver().setup();<br \/>\nWebDriverManager.iedriver().setup();<\/code><br \/>\n<strong>To use WebDriverManager in the selenium script we can download the jar file directly from the following link:<\/strong><br \/>\n<a href=\"https:\/\/jar-download.com\/artifact-search\/webdrivermanager\">https:\/\/jar-download.com\/artifact-search\/webdrivermanager<\/a><br \/>\nand add jar file in the project using the following steps:<br \/>\n<strong>Project -> Build path -> Configure Build path -> Libraries -> Add jars<\/strong><\/p>\n<p>Other ways we can use the maven dependency. In the pom.xml file, we need to add the below dependency to have WebDriverManager in our <a href=\"https:\/\/studysection.com\/blog\/how-to-use-two-databases-in-a-single-project\/\">Project<\/a>.<\/p>\n<p><code>&lt;!-- https:\/\/mvnrepository.com\/artifact\/io.github.bonigarcia\/webdrivermanager --><br \/>\n&lt;dependency><br \/>\n    &lt;groupId>io.github.bonigarcia&lt;\/groupId><br \/>\n    &lt;artifactId>webdrivermanager&lt;\/artifactId><br \/>\n    &lt;version>4.4.3&lt;\/version><br \/>\n&lt;\/dependency><\/code><br \/>\n<strong>Below is the example to launch the different browsers using the selenium WebDriverManager:<\/strong><br \/>\n<code>package testing;<br \/>\nimport org.openqa.selenium.WebDriver;<br \/>\nimport org.openqa.selenium.chrome.ChromeDriver;<br \/>\nimport org.openqa.selenium.edge.EdgeDriver;<br \/>\nimport org.openqa.selenium.firefox.FirefoxDriver;<br \/>\nimport org.openqa.selenium.ie.InternetExplorerDriver;<br \/>\nimport org.openqa.selenium.opera.OperaDriver;<br \/>\nimport io.github.bonigarcia.wdm.WebDriverManager;<br \/>\npublic class driverMngr {<br \/>\n  WebDriver driver;<br \/>\n  public void browserSet(String browser) {<br \/>\n    if (browser.equals(\"chrome\")) {<br \/>\n      WebDriverManager.chromedriver().setup();<br \/>\n      driver = new ChromeDriver();<br \/>\n    } else if (browser.equals(\"firefox\")) {<br \/>\n      WebDriverManager.firefoxdriver().setup();<br \/>\n      driver = new FirefoxDriver();<br \/>\n    } else if (browser.equals(\"edge\")) {<br \/>\n      WebDriverManager.edgedriver().setup();<br \/>\n      driver = new EdgeDriver();<br \/>\n    } else if (browser.equals(\"opera\")) {<br \/>\n      WebDriverManager.operadriver().setup();<br \/>\n      driver = new OperaDriver();<br \/>\n    } else if (browser.equals(\"ie\")) {<br \/>\n      WebDriverManager.iedriver().setup();<br \/>\n      driver = new InternetExplorerDriver();<br \/>\n    } else {<br \/>\n      System.out.println(\"Browser driver not mentioned\");<br \/>\n    }<br \/>\n    driver.manage().window().maximize();<br \/>\n    driver.get(\"https:\/\/www.webnersolutions.com\/\");<br \/>\n    System.out.println(driver.getTitle());<br \/>\n    driver.quit();<br \/>\n  }<br \/>\n  public static void main(String arg[]) {<br \/>\n    driverMngr call = new driverMngr();<br \/>\n    call.browserSet(\"edge\");<br \/>\n    call.browserSet(\"chrome\");<br \/>\n  }<br \/>\n}<\/code><\/p>\n<p><strong>Result with Screenshot:<\/strong><br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/07\/code.png\" alt=\"code\"\/><\/p>\n<p><small><em>Get certification for your knowledge in the fundamentals of Computer functioning by clearing the <a href=\"https:\/\/www.studysection.com\/computer-applications-diploma-advanced\">Computer Certification Exam<\/a> conducted by StudySection. After going through this Computer Certification exam, you will be able to evaluate your basic knowledge of computers.<\/em><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WebDriverManager is a class that downloads and sets the browser\u2019s driver binaries automatically like chromedriver.exe, geckodriver.exe, and edgedriver.exe, etc required<\/p>\n","protected":false},"author":1,"featured_media":4619,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[124,681],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Selenium WebDriverManager - StudySection Blog<\/title>\n<meta name=\"description\" content=\"WebDriverManager is a class that downloads and sets the browser\u2019s driver binaries automatically required by Selenium WebDriver API.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Selenium WebDriverManager - StudySection Blog\" \/>\n<meta property=\"og:description\" content=\"WebDriverManager is a class that downloads and sets the browser\u2019s driver binaries automatically required by Selenium WebDriver API.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Posts on famous people, innovations and educational topics\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/studysection\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-15T04:29:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-15T06:29:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/07\/Selenium-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin-studysection-blog\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@studysection\" \/>\n<meta name=\"twitter:site\" content=\"@studysection\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin-studysection-blog\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/\"},\"author\":{\"name\":\"admin-studysection-blog\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\"},\"headline\":\"Selenium WebDriverManager\",\"datePublished\":\"2021-07-15T04:29:44+00:00\",\"dateModified\":\"2021-07-15T06:29:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/\"},\"wordCount\":297,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"keywords\":[\"selenium\",\"WebDriver\"],\"articleSection\":[\"Learn and Grow\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/\",\"url\":\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/\",\"name\":\"Selenium WebDriverManager - StudySection Blog\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/#website\"},\"datePublished\":\"2021-07-15T04:29:44+00:00\",\"dateModified\":\"2021-07-15T06:29:56+00:00\",\"description\":\"WebDriverManager is a class that downloads and sets the browser\u2019s driver binaries automatically required by Selenium WebDriver API.\",\"breadcrumb\":{\"@id\":\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/studysection.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Selenium WebDriverManager\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/studysection.com\/blog\/#website\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"name\":\"Blog Posts on famous people, innovations and educational topics\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/studysection.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/studysection.com\/blog\/#organization\",\"name\":\"StudySection\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"contentUrl\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"width\":920,\"height\":440,\"caption\":\"StudySection\"},\"image\":{\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/studysection\",\"https:\/\/twitter.com\/studysection\",\"https:\/\/www.instagram.com\/study.section\/\",\"https:\/\/www.linkedin.com\/company\/studysection\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\",\"name\":\"admin-studysection-blog\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"caption\":\"admin-studysection-blog\"},\"url\":\"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Selenium WebDriverManager - StudySection Blog","description":"WebDriverManager is a class that downloads and sets the browser\u2019s driver binaries automatically required by Selenium WebDriver API.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/","og_locale":"en_US","og_type":"article","og_title":"Selenium WebDriverManager - StudySection Blog","og_description":"WebDriverManager is a class that downloads and sets the browser\u2019s driver binaries automatically required by Selenium WebDriver API.","og_url":"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/","og_site_name":"Blog Posts on famous people, innovations and educational topics","article_publisher":"https:\/\/www.facebook.com\/studysection","article_published_time":"2021-07-15T04:29:44+00:00","article_modified_time":"2021-07-15T06:29:56+00:00","og_image":[{"width":300,"height":200,"url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/07\/Selenium-1.png","type":"image\/png"}],"author":"admin-studysection-blog","twitter_card":"summary_large_image","twitter_creator":"@studysection","twitter_site":"@studysection","twitter_misc":{"Written by":"admin-studysection-blog","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/#article","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/"},"author":{"name":"admin-studysection-blog","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402"},"headline":"Selenium WebDriverManager","datePublished":"2021-07-15T04:29:44+00:00","dateModified":"2021-07-15T06:29:56+00:00","mainEntityOfPage":{"@id":"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/"},"wordCount":297,"commentCount":0,"publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"keywords":["selenium","WebDriver"],"articleSection":["Learn and Grow"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/","url":"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/","name":"Selenium WebDriverManager - StudySection Blog","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/#website"},"datePublished":"2021-07-15T04:29:44+00:00","dateModified":"2021-07-15T06:29:56+00:00","description":"WebDriverManager is a class that downloads and sets the browser\u2019s driver binaries automatically required by Selenium WebDriver API.","breadcrumb":{"@id":"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/studysection.com\/blog\/selenium-webdrivermanager\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/studysection.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Selenium WebDriverManager"}]},{"@type":"WebSite","@id":"https:\/\/studysection.com\/blog\/#website","url":"https:\/\/studysection.com\/blog\/","name":"Blog Posts on famous people, innovations and educational topics","description":"","publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/studysection.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/studysection.com\/blog\/#organization","name":"StudySection","url":"https:\/\/studysection.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","contentUrl":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","width":920,"height":440,"caption":"StudySection"},"image":{"@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/studysection","https:\/\/twitter.com\/studysection","https:\/\/www.instagram.com\/study.section\/","https:\/\/www.linkedin.com\/company\/studysection"]},{"@type":"Person","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402","name":"admin-studysection-blog","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","caption":"admin-studysection-blog"},"url":"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/"}]}},"views":545,"_links":{"self":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/4618"}],"collection":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/comments?post=4618"}],"version-history":[{"count":5,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/4618\/revisions"}],"predecessor-version":[{"id":4625,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/4618\/revisions\/4625"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media\/4619"}],"wp:attachment":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media?parent=4618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/categories?post=4618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/tags?post=4618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}