{"id":73732,"date":"2018-02-21T19:00:45","date_gmt":"2018-02-21T17:00:45","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=73732"},"modified":"2018-02-21T10:42:12","modified_gmt":"2018-02-21T08:42:12","slug":"selenium-java-google-search","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html","title":{"rendered":"Selenium with Java: Google Search"},"content":{"rendered":"<h2>1. Overview<\/h2>\n<p>In this tutorial, we will be exploring the basics of how to use Selenium with Java. We will use Selenium to open Google, search, and click a URL.<\/p>\n<p>The code is available on <a href=\"https:\/\/github.com\/michaelcgood\/Selenium-Google-Search-Example\" target=\"_blank\" rel=\"noopener\">Github<\/a>.<\/p>\n<h2>2. What is Selenium?<\/h2>\n<p>Selenium automates web browsers. That\u2019s really it.<\/p>\n<p>Selenium enables us to emulate user interaction with a web page. There are two Selenium products we can use: Selenium WebDriver and Selenium IDE. We will be using WebDriver.<\/p>\n<p><strong>What is WebDriver?<\/strong> WebDriver is an official W3C Specification, and in essence it is a way of interacting with a web browser. Previously, with Selenium RC, Selenium would operate with the browser by injecting JavaScript to interact with elements. With the adoption of the WebDriver specification, companies like Google, Mozilla, and Microsoft release their browser with the ability to be controlled by a hook, that Selenium can tap into. This hook enables Selenium to interact with the web browser in the same way that humans do.<\/p>\n<p>We will be using Google Chrome and therefore it is required that we download the <a href=\"https:\/\/chromedriver.storage.googleapis.com\/index.html?path=2.35\/\">chromedriver<\/a>.<\/p>\n<p>After downloading the driver, we need to execute the file.<br \/>\nOn Macs, we can simply do this for instance:<\/p>\n<pre class=\"brush:bash\">.\/chromedriver<\/pre>\n<h2>3. pom.xml<\/h2>\n<p>I use Spring Tool Suite and created a new Spring Starter project, which wasn\u2019t necessary, but I tend to like Spring. So Selenium is managed by the Spring Boot Starter Parent actually. The version is 2.53.1.<\/p>\n<pre class=\"brush:xml\">&lt;!-- typical pom beginning--&gt;\r\n\t&lt;parent&gt;\r\n\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;1.5.10.RELEASE&lt;\/version&gt;\r\n\t\t&lt;relativePath \/&gt; &lt;!-- lookup parent from repository --&gt;\r\n\t&lt;\/parent&gt;\r\n\r\n\t&lt;properties&gt;\r\n\t\t&lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;\r\n\t\t&lt;project.reporting.outputEncoding&gt;UTF-8&lt;\/project.reporting.outputEncoding&gt;\r\n\t\t&lt;java.version&gt;1.8&lt;\/java.version&gt;\r\n\t&lt;\/properties&gt;\r\n\r\n\t&lt;dependencies&gt;\r\n\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;com.h2database&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;h2&lt;\/artifactId&gt;\r\n\t\t\t&lt;scope&gt;runtime&lt;\/scope&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\r\n\t\t\t&lt;scope&gt;test&lt;\/scope&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.seleniumhq.selenium&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;selenium-java&lt;\/artifactId&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\r\n\t&lt;\/dependencies&gt;\r\n\r\n\t&lt;build&gt;\r\n\t\t&lt;plugins&gt;\r\n\t\t\t&lt;plugin&gt;\r\n\t\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t\t&lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;\r\n\t\t\t&lt;\/plugin&gt;\r\n\t\t&lt;\/plugins&gt;\r\n\t&lt;\/build&gt;\r\n&lt;!-- typical pom ending--&gt;<\/pre>\n<h2>4. Open Chrome and Search<\/h2>\n<p>For this step, we will be establishing the connection to the chromedriver, opening the browser, and searching for \u201cSelenium\u201d.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>The port we target for our localhost is 9515 because the chromedriver runs on the local server\u2019s port 9515.<\/p>\n<p><em>RemoteWebDriver <\/em> implements <em>WebDriver<\/em> and WebDriver\u2019s goal is to supply an object-oriented API that provides support for modern advanced web-app testing problems. So, we can tell based on these facts that RemoteWebDriver is the implementation that allows the use of a remote browser. The benefits include separation of where the tests run from where the browser is and the ability to test with browsers not available on the current OS. The cons include the fact that we need an external servlet container to be running and there may be latency if an exception is thrown.<\/p>\n<pre class=\"brush:java\">\/\/ create a Chrome Web Driver\r\n            URL local = new URL(\"http:\/\/localhost:9515\");\r\n            WebDriver driver = new RemoteWebDriver(local, DesiredCapabilities.chrome());\r\n            \/\/ open the browser and go to open google.com\r\n            driver.get(\"https:\/\/www.google.com\"); \r\n            \r\n            driver.findElement(By.id(\"lst-ib\")).sendKeys(\"Selenium\");\r\n            driver.findElement(By.name(\"btnK\")).click();\r\n            driver.manage().window().maximize();<\/pre>\n<h2>5. Get Pages and Click<\/h2>\n<p>WebDriver gives us the methods <em>findElement<\/em> and <em>findElements<\/em> method to locate element(s) on a web page. These methods accept a <em>By<\/em> object as a parameter. <em>By<\/em> has methods to locate elements within a document with the help of a locator value. Selenium has <a href=\"https:\/\/seleniumhq.github.io\/selenium\/docs\/api\/java\/\">documented their API<\/a> well.<\/p>\n<p>Once we understand how Selenium is used to identify elements, it is easy to read any of the the <em>driver.findElements(By\u2026)<\/em> methods. But we need to know how to write them too. Using a browser, like Chrome, we can right click (or the equivalent) to <em>Inspect<\/em> an element to get its HTML\/CSS information. Also, we can \u201cView Source\u201d to get more complete information as well.<\/p>\n<p>To demonstrate how to scroll on a web page, we perform <em>jse.executeScript(\u201cwindow.scrollBy(0,250)\u201d, \u201c\u201d)<\/em>.<br \/>\nLike the name suggests, <em>JavaScriptExecutor <\/em> executes JavaScript. JavaScriptExecutor is an interface provided through Selenium WebDriver. It provides two methods \u201cexecutescript\u201d &amp; \u201cexecuteAsyncScript\u201d to run javascript on the selected window or current page.<\/p>\n<p>With the code below, it may be possible to create a more comprehensive bot to search Google and click URLs for several pages.<\/p>\n<pre class=\"brush:java\">\/\/ get the number of pages\r\n            int size = driver.findElements(By.cssSelector(\"[valign='top'] &gt; td\")).size();\r\n            for(int j = 1 ; j &lt; size ; j++) {\r\n                if (j &gt; 1) {\/\/ we don't need to navigate to the first page\r\n                    driver.findElement(By.cssSelector(\"[aria-label='Page \" + j + \"']\")).click(); \/\/ navigate to page number j\r\n                }\r\n\r\n                String pagesearch = driver.getCurrentUrl();\r\n\r\n                List&lt;WebElement&gt; findElements = driver.findElements(By.xpath(\"\/\/*[@id='rso']\/\/h3\/a\"));\r\n                System.out.println(findElements.size());\r\n\r\n                for(int i=0;i&lt;findElements.size();i++){\r\n                    findElements= driver.findElements(By.xpath(\"\/\/*[@id='rso']\/\/h3\/a\"));                \r\n                    findElements.get(i).click(); \r\n\r\n                    driver.navigate().to(pagesearch);\r\n                    JavascriptExecutor jse = (JavascriptExecutor) driver;\r\n                    \/\/Scroll vertically downward by 250 pixels\r\n                    jse.executeScript(\"window.scrollBy(0,250)\", \"\");\r\n                }\r\n            }<\/pre>\n<h2>6. Conclusion<\/h2>\n<p>This was a basic introduction to Selenium with Java. As we discovered, in Selenium Webdriver, locators like XPath, CSS, etc. are used to identify and perform operations on a web page. It is also possible to execute arbitrary JavaScript.<br \/>\nThe complete code can be found on <a href=\"https:\/\/github.com\/michaelcgood\/Selenium-Google-Search-Example\" target=\"_blank\" rel=\"noopener\">Github<\/a>.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Michael Good, partner at our <a href=\"http:\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/michaelcgood.com\/selenium-java-google-search\/\" target=\"_blank\" rel=\"noopener\">Selenium with Java: Google Search<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Overview In this tutorial, we will be exploring the basics of how to use Selenium with Java. We will use Selenium to open Google, search, and click a URL. The code is available on Github. 2. What is Selenium? Selenium automates web browsers. That\u2019s really it. Selenium enables us to emulate user interaction with &hellip;<\/p>\n","protected":false},"author":5558,"featured_media":231,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[287],"class_list":["post-73732","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-selenium"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Selenium with Java: Google Search - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Overview In this tutorial, we will be exploring the basics of how to use Selenium with Java. We will use Selenium to open Google, search, and click a\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Selenium with Java: Google Search - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Overview In this tutorial, we will be exploring the basics of how to use Selenium with Java. We will use Selenium to open Google, search, and click a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-21T17:00:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Good\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Good\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html\"},\"author\":{\"name\":\"Michael Good\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/d13cc729556b91450ae21878a82139ed\"},\"headline\":\"Selenium with Java: Google Search\",\"datePublished\":\"2018-02-21T17:00:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html\"},\"wordCount\":648,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/selenium-logo.jpg\",\"keywords\":[\"Selenium\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html\",\"name\":\"Selenium with Java: Google Search - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/selenium-logo.jpg\",\"datePublished\":\"2018-02-21T17:00:45+00:00\",\"description\":\"1. Overview In this tutorial, we will be exploring the basics of how to use Selenium with Java. We will use Selenium to open Google, search, and click a\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/selenium-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/selenium-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/02\\\/selenium-java-google-search.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Selenium with Java: Google Search\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/d13cc729556b91450ae21878a82139ed\",\"name\":\"Michael Good\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g\",\"caption\":\"Michael Good\"},\"description\":\"Michael is a software engineer located in the Washington DC area that is interested in Java, cyber security, and open source technologies. Follow his personal blog to read more from Michael.\",\"sameAs\":[\"http:\\\/\\\/www.michaelcgood.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/michael-good\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Selenium with Java: Google Search - Java Code Geeks","description":"1. Overview In this tutorial, we will be exploring the basics of how to use Selenium with Java. We will use Selenium to open Google, search, and click a","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:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html","og_locale":"en_US","og_type":"article","og_title":"Selenium with Java: Google Search - Java Code Geeks","og_description":"1. Overview In this tutorial, we will be exploring the basics of how to use Selenium with Java. We will use Selenium to open Google, search, and click a","og_url":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2018-02-21T17:00:45+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","type":"image\/jpeg"}],"author":"Michael Good","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Michael Good","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html"},"author":{"name":"Michael Good","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/d13cc729556b91450ae21878a82139ed"},"headline":"Selenium with Java: Google Search","datePublished":"2018-02-21T17:00:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html"},"wordCount":648,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","keywords":["Selenium"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html","url":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html","name":"Selenium with Java: Google Search - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","datePublished":"2018-02-21T17:00:45+00:00","description":"1. Overview In this tutorial, we will be exploring the basics of how to use Selenium with Java. We will use Selenium to open Google, search, and click a","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2018\/02\/selenium-java-google-search.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Selenium with Java: Google Search"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/d13cc729556b91450ae21878a82139ed","name":"Michael Good","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g","caption":"Michael Good"},"description":"Michael is a software engineer located in the Washington DC area that is interested in Java, cyber security, and open source technologies. Follow his personal blog to read more from Michael.","sameAs":["http:\/\/www.michaelcgood.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/michael-good"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/73732","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/5558"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=73732"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/73732\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/231"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=73732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=73732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=73732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}