{"id":6073,"date":"2012-12-26T10:15:17","date_gmt":"2012-12-26T08:15:17","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=6073"},"modified":"2012-12-26T10:15:17","modified_gmt":"2012-12-26T08:15:17","slug":"a-seleniumwebdriver-example-in-java","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html","title":{"rendered":"A Selenium\/WebDriver example in Java"},"content":{"rendered":"<p>A couple of years back, I was pitching for some work and the client wanted to see how I would tackle a real world problem. They asked me to automate some tasks on the woot.com web site.<\/p>\n<p>The task was to go to various woot web sites and to read the product name and price of the offer of the day.<\/p>\n<p>I wrote a little bit of Selenium code and thought I&#8217;d post it here in case any of it is useful to anyone.<\/p>\n<p>I got the job &#8211; so it can&#8217;t be too bad.<\/p>\n<p>First up I defined an interface to represent a woot page:<\/p>\n<pre class=\"brush:java\">package uk.co.doogle;\r\n\r\nimport com.thoughtworks.selenium.Selenium;\r\n\r\n\/**\r\n\r\n* This interface defines the methods we must implement for classes\r\n\r\n* of type Woot. Woot web sites have one item for sale every 24 hours.\r\n\r\n* @author Tony\r\n\r\n*\/\r\n\r\npublic interface Woot {\r\n\r\n\/**\r\n\r\n* Defines the interface of the method we use to get the price\r\n\r\n* of the item for sale on a Woot website\r\n\r\n* @param selenium the selenium object we pass in which is used to interact\r\n\r\n* with the browser\/web page\r\n\r\n* @return String representation of the price of the item for sale\r\n\r\n*\/\r\n\r\npublic String getPrice(Selenium selenium);\r\n\r\n\/**\r\n\r\n* Defines the interface of the method we use to get the product name\r\n\r\n* of the item for sale on a Woot website\r\n\r\n* @param selenium the selenium object we pass in which is used to interact\r\n\r\n* with the browser\/web page\r\n\r\n* @return String representation of the product name of the item for sale\r\n\r\n*\/\r\n\r\npublic String getProductName(Selenium selenium);\r\n\r\n}<\/pre>\n<p>Then I implemented this interface a few times to represent the actual behaviour of the various woot pages &#8211; here for example if the winewoot page:<\/p>\n<pre class=\"brush:java\">public class WineWoot extends BaseWoot {\r\n\r\n\/**\r\n\r\n* Constructor\r\n\r\n* @param url pass in the url of the web site\r\n\r\n*\/\r\n\r\npublic WineWoot(String url) {\r\n\r\nsuper(url);\r\n\r\n}\r\n\r\n\/**\r\n\r\n* Implementation of the method to get the price of the object for sale on\r\n\r\n* the Woot web site.\r\n\r\n*\/\r\n\r\npublic String getPrice(Selenium selenium) {\r\n\r\n\/\/if you need to update the xpath to the piece of text of interest - use xpather firefox plugin\r\n\r\nString xPath = '\/\/html\/body\/header\/nav\/ul\/li[8]\/section\/div\/a\/div[3]\/span';\r\n\r\nselenium.waitForCondition('selenium.isElementPresent(\\'xpath=' + xPath + '\\');', '12000');\r\n\r\nreturn selenium.getText(xPath) + ' ';\r\n\r\n}\r\n\r\n\/**\r\n\r\n* Implementation of the method to get the product name of the item for sale\r\n\r\n* on the Woot web site\r\n\r\n*\r\n\r\n*\/\r\n\r\npublic String getProductName(Selenium selenium) {\r\n\r\n\/\/if you need to update the xpath to the piece of text of interest - use xpather firefox plugin\r\n\r\nString xPath = '\/\/html\/body\/header\/nav\/ul\/li[8]\/section\/div\/a\/div[2]';\r\n\r\nselenium.waitForCondition('selenium.isElementPresent(\\'xpath=' + xPath + '\\');', '12000');\r\n\r\nreturn selenium.getText(xPath) + ' ';\r\n\r\n}\r\n\r\n}<\/pre>\n<p>Note &#8211; back then I used the xPather plugin &#8211; this doesn&#8217;t work for recent versions of firefox, so now I use <a href=\"http:\/\/getfirebug.com\/\" target=\"_blank\">firebug<\/a>.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Then I wrote the actual &#8216;test&#8217;:<\/p>\n<pre class=\"brush:java\">package uk.co.doogle;\r\n\r\nimport com.thoughtworks.selenium.*;\r\n\r\nimport java.io.BufferedWriter;\r\n\r\nimport java.io.FileWriter;\r\n\r\nimport java.util.ArrayList;\r\n\r\nimport java.util.List;\r\n\r\n\/**\r\n\r\n* This class is where we define tests of the Woot web sites\r\n\r\n* @author Tony\r\n\r\n*\r\n\r\n*\/\r\n\r\npublic class TestWoots extends SeleneseTestCase {\r\n\r\n\/**\r\n\r\n* Outputstream for our results file\r\n\r\n*\/\r\n\r\nprivate BufferedWriter out;\r\n\r\n\/**\r\n\r\n* Our list of Woot web sites we want to test\r\n\r\n*\/\r\n\r\nprivate List&lt;BaseWoot&gt; sites = new ArrayList&lt;BaseWoot&gt;();\r\n\r\n\/**\r\n\r\n* This is where we do any set up needed before our test(s) run.\r\n\r\n* Here we add the list of Woot web sites we want to test and we create an\r\n\r\n* output stream ready to write results to file\r\n\r\n*\/\r\n\r\npublic void setUp() throws Exception {\r\n\r\nsites.add(new BaseWoot('http:\/\/www.woot.com\/'));\r\n\r\nsites.add(new ShirtWoot('http:\/\/shirt.woot.com\/'));\r\n\r\nsites.add(new WineWoot('http:\/\/wine.woot.com\/'));\r\n\r\ntry {\r\n\r\n\/\/let's append to our file...\r\n\r\nFileWriter fstream = new FileWriter('out.csv', true);\r\n\r\nout = new BufferedWriter(fstream);\r\n\r\nout.write('Site, Product Name, Product Price');\r\n\r\nout.newLine();\r\n\r\n} catch (Exception e) {\r\n\r\nSystem.err.println('Error creating a file to write our results to: ' + e.getMessage());\r\n\r\n}\r\n\r\n}\r\n\r\n\/**\r\n\r\n* Tests getting the item name and price for the item for sale on each Woot web site we test. We see the results of the test\r\n\r\n* in std out in the form of a table and we also write the results to a csv file.\r\n\r\n* If there are any errors getting the information, this is displayed instead.\r\n\r\n*\r\n\r\n* How to run me: open command prompt and from the directory where our selenium server is\r\n\r\n* located type: java -jar selenium-server-standalone-2.0b3.jar (or equivalent) and wait for the server to start up.\r\n\r\n* Then just run this unit test.\r\n\r\n*\/\r\n\r\npublic void testGetItemsAndPrices() throws Exception {\r\n\r\n\/\/for each Woot site in our list of sites we want to test\r\n\r\nfor (BaseWoot woot : sites) {\r\n\r\n\/\/let's put this in a try catch block as we want to try ALL the sites - some may be down or slow...\r\n\r\ntry {\r\n\r\nselenium = new DefaultSelenium('localhost', 4444, '*firefox', woot.getUrl());\r\n\r\nselenium.start();\r\n\r\nselenium.open('\/');\r\n\r\nselenium.waitForPageToLoad('50000');\r\n\r\n\/\/add a new row for our table to std out\r\n\r\nSystem.out.println();\r\n\r\n\/\/print out the information we need - the site, the title of the item for sale and the price\r\n\r\nString siteUrl = woot.getUrl();\r\n\r\nString productName = woot.getProductName(selenium);\r\n\r\nString productPrice = woot.getPrice(selenium);\r\n\r\n\/\/sometimes there are commas which mess up our csv file - so\r\n\r\n\/\/we substitute with ;\r\n\r\nproductName = productName.replace(',', ';');\r\n\r\nSystem.out.print('website: ' + siteUrl + ' ');\r\n\r\nSystem.out.print('product name: ' + productName);\r\n\r\nSystem.out.print('price: ' + productPrice);\r\n\r\nout.write(siteUrl + ', ' + productName + ', ' + productPrice);\r\n\r\nout.newLine();\r\n\r\n} catch (Exception ex) {\r\n\r\n\/\/here may may see that the web site under test has changed and the xpath to the price or product name may need to\r\n\r\n\/\/be changed in the Woot class\r\n\r\nSystem.out.print('problem getting the data for: ' + woot.getUrl()+ ' ' + ex.getMessage() + ' ');\r\n\r\n} finally {\r\n\r\nselenium.stop();\r\n\r\n}\r\n\r\n}\r\n\r\n}\r\n\r\n\/**\r\n\r\n* Any tear-down we need to do to cleanup after our test(s).\r\n\r\n* Here we just stop selenium and close the output stream\r\n\r\n*\/\r\n\r\npublic void tearDown() throws Exception {\r\n\r\nselenium.stop();\r\n\r\nout.close();\r\n\r\n}\r\n\r\n}<\/pre>\n<p>I know this code worked for a couple of years, and I have made some minor changes to get it to work with the current woot.com web sites &#8211; all I had to do was get the latest <a href=\"http:\/\/seleniumhq.org\/download\/\" target=\"_blank\">selenium-server-standalone.jar<\/a> for it to work with the latest firefox and also to update the xpaths to the price and product name information. That would be a good improvement to the code &#8211; to make it data driven &#8211; such that we could just update the xpaths in a config file rather than changing the hard-coded ones I have used here. That was the only feedback from the client actually.<br \/>\n&nbsp;<\/p>\n<p><strong><em>Reference: <\/em><\/strong><a href=\"http:\/\/doogleonline.blogspot.co.uk\/2012\/11\/a-seleniumwebdriver-example-in-java.html\">A Selenium\/WebDriver example in Java<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Tony Dugay at the <a href=\"http:\/\/doogleonline.blogspot.co.uk\/\">Doogle Ltd<\/a> blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A couple of years back, I was pitching for some work and the client wanted to see how I would tackle a real world problem. They asked me to automate some tasks on the woot.com web site. The task was to go to various woot web sites and to read the product name and price &hellip;<\/p>\n","protected":false},"author":343,"featured_media":231,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[287,273,286],"class_list":["post-6073","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-selenium","tag-testing","tag-webdriver"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>A Selenium\/WebDriver example in Java<\/title>\n<meta name=\"description\" content=\"A couple of years back, I was pitching for some work and the client wanted to see how I would tackle a real world problem. They asked me to automate some\" \/>\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\/2012\/12\/a-seleniumwebdriver-example-in-java.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A Selenium\/WebDriver example in Java\" \/>\n<meta property=\"og:description\" content=\"A couple of years back, I was pitching for some work and the client wanted to see how I would tackle a real world problem. They asked me to automate some\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.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=\"2012-12-26T08:15:17+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=\"Tony Dugay\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/AntonyDugay\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tony Dugay\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html\"},\"author\":{\"name\":\"Tony Dugay\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/7e2a9cb7f79fa984a110fb9fc38babd4\"},\"headline\":\"A Selenium\\\/WebDriver example in Java\",\"datePublished\":\"2012-12-26T08:15:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html\"},\"wordCount\":299,\"commentCount\":11,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/selenium-logo.jpg\",\"keywords\":[\"Selenium\",\"Testing\",\"WebDriver\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html\",\"name\":\"A Selenium\\\/WebDriver example in Java\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/selenium-logo.jpg\",\"datePublished\":\"2012-12-26T08:15:17+00:00\",\"description\":\"A couple of years back, I was pitching for some work and the client wanted to see how I would tackle a real world problem. They asked me to automate some\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.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\\\/2012\\\/12\\\/a-seleniumwebdriver-example-in-java.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\":\"A Selenium\\\/WebDriver example in Java\"}]},{\"@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\\\/7e2a9cb7f79fa984a110fb9fc38babd4\",\"name\":\"Tony Dugay\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ea39590091615f13da2826fadee7ddce4a457b7da07fbf0d4701c0ac02ac4553?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ea39590091615f13da2826fadee7ddce4a457b7da07fbf0d4701c0ac02ac4553?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ea39590091615f13da2826fadee7ddce4a457b7da07fbf0d4701c0ac02ac4553?s=96&d=mm&r=g\",\"caption\":\"Tony Dugay\"},\"description\":\"Tony is a Developer\\\/Tester based in the UK. He had over 5 years working professionally as a Java Web Developer in the airline industry and then later as a contractor. Since then he has mainly worked on software test automation using tools such as SilkTest, QTP and of course Java\\\/Selenium.\",\"sameAs\":[\"http:\\\/\\\/doogleonline.blogspot.co.uk\\\/\",\"http:\\\/\\\/www.linkedin.com\\\/in\\\/automatedsoftwaretester\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/AntonyDugay\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/tony-dugay\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"A Selenium\/WebDriver example in Java","description":"A couple of years back, I was pitching for some work and the client wanted to see how I would tackle a real world problem. They asked me to automate some","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\/2012\/12\/a-seleniumwebdriver-example-in-java.html","og_locale":"en_US","og_type":"article","og_title":"A Selenium\/WebDriver example in Java","og_description":"A couple of years back, I was pitching for some work and the client wanted to see how I would tackle a real world problem. They asked me to automate some","og_url":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-12-26T08:15:17+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":"Tony Dugay","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/AntonyDugay","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Tony Dugay","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html"},"author":{"name":"Tony Dugay","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/7e2a9cb7f79fa984a110fb9fc38babd4"},"headline":"A Selenium\/WebDriver example in Java","datePublished":"2012-12-26T08:15:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html"},"wordCount":299,"commentCount":11,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","keywords":["Selenium","Testing","WebDriver"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html","url":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html","name":"A Selenium\/WebDriver example in Java","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/selenium-logo.jpg","datePublished":"2012-12-26T08:15:17+00:00","description":"A couple of years back, I was pitching for some work and the client wanted to see how I would tackle a real world problem. They asked me to automate some","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/a-seleniumwebdriver-example-in-java.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\/2012\/12\/a-seleniumwebdriver-example-in-java.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":"A Selenium\/WebDriver example in Java"}]},{"@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\/7e2a9cb7f79fa984a110fb9fc38babd4","name":"Tony Dugay","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ea39590091615f13da2826fadee7ddce4a457b7da07fbf0d4701c0ac02ac4553?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ea39590091615f13da2826fadee7ddce4a457b7da07fbf0d4701c0ac02ac4553?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ea39590091615f13da2826fadee7ddce4a457b7da07fbf0d4701c0ac02ac4553?s=96&d=mm&r=g","caption":"Tony Dugay"},"description":"Tony is a Developer\/Tester based in the UK. He had over 5 years working professionally as a Java Web Developer in the airline industry and then later as a contractor. Since then he has mainly worked on software test automation using tools such as SilkTest, QTP and of course Java\/Selenium.","sameAs":["http:\/\/doogleonline.blogspot.co.uk\/","http:\/\/www.linkedin.com\/in\/automatedsoftwaretester","https:\/\/x.com\/http:\/\/twitter.com\/AntonyDugay"],"url":"https:\/\/www.javacodegeeks.com\/author\/tony-dugay"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/6073","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\/343"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=6073"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/6073\/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=6073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=6073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=6073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}