{"id":271049,"date":"2020-10-20T12:14:27","date_gmt":"2020-10-20T12:14:27","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=271049"},"modified":"2020-10-20T12:14:29","modified_gmt":"2020-10-20T12:14:29","slug":"page-object-modelpom-testing-using-selenium-webdriver","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/","title":{"rendered":"Page Object Model(POM) based Testing using Selenium WebDriver"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>Maintaining 1000 lines of code in a single class file is a heavy task and also it increases its complexity. In order to maintain the project structure and efficient performance of the selenium scripts, it is necessary to use different pages for different tasks. <\/p>\n\n\n\n<p>To ease the access of distributing the code into different modules, the Page Object Model(POM) comes to the rescue. In this blog, we will be learning some of the core concepts of Page Object Model(POM).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is Page Object Model?<\/h3>\n\n\n\n<p>Page Object Model is a design pattern which has become popular in test automation for enhancing test maintenance and reducing code duplication. A page object is an object-oriented class that serves as an interface to a page of your AUT.<\/p>\n\n\n\n<p>The tests than use the methods of this page object class whenever they need to interact with the UI of that page. The benefit is that if UI changes for the page, the tests don\u2019t need to be changed, only the code within the page object needs to change.<\/p>\n\n\n\n<p>Subsequently all changes to support that new UI are located in one place so we don&#8217;t have to edit much.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Advantages of POM<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Makes our code cleaner and easy to understand &#8211; keeps our tests and element locators separately.<\/li><li>Easy to visualise each step of the scenario, view and edit test cases intuitively.<\/li><li>Test cases become short and optimised as we can reuse page object methods in the POM classes.<\/li><li>Any UI change can easily be implement, update and maintain into the Page Objects and Classes.<\/li><li>Re-usability of code &#8211; object repository is independent of test cases.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">How to Implement POM?<\/h3>\n\n\n\n<p><strong>Create a New Maven Project<\/strong><\/p>\n\n\n\n<p>Create a Maven Project so we don\u2019t have to add all jar files into the library which are needed for our project.<\/p>\n\n\n\n<p>It will automatically download and add all the jar files into your project which are required by just adding the dependencies into the&nbsp;<strong>POM.xml<\/strong>&nbsp;file of your project.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"896\" height=\"341\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png\" alt=\"POM_structure\" class=\"wp-image-271156\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png 896w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5-300x114.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5-250x95.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5-768x292.png 768w\" sizes=\"(max-width: 896px) 100vw, 896px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Create a new Package<\/strong><\/p>\n\n\n\n<p>After the above step create a new package under our project by any desired name of your choice. The package which you are creating is a user-defined package which will create a folder in your workspace.<\/p>\n\n\n\n<p><strong>Create a New Class<\/strong><\/p>\n\n\n\n<p>After creating the package you have to create a class under the package which you have created in above step. We can also create an object of a class and access it from another class.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Create a Class for Browser<\/strong> <\/h4>\n\n\n\n<p>We will create a method while passing parameters with it having driver, browser name and URL of the website. <\/p>\n\n\n\n<p>Under this method we will provide multiple browser options for the user to choose between them and pass the requirement drivers under the specific conditions of the browser.<\/p>\n\n\n\n<p>After above step we will maximise the browser and add <strong>ImplicitWait<\/strong> and <strong>pageLoadTimeout<\/strong> with it, so if the processor of the system is slow or internet is slow than elements can wait according to the given time.<\/p>\n\n\n\n<p>Than we will pass the url of the website using <strong>driver.get(appURL);<\/strong> and in the appURL we will pass the website URL.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @author    Webkul\n * @copyright Copyright (c) 2010-2020 Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n\npublic class BrowserFactory {\n\t\n\tpublic static WebDriver startapplication(WebDriver driver, String BrowserName, String appURL)\n\t{\n\t\tif(BrowserName.equals(&quot;Chrome&quot;))\n\t\t{\n\t\t\tSystem.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;.\/Drivers\/chromedriver123.exe&quot;);\n\t\t\tdriver= new ChromeDriver();\n\t\t\t\n\t\t}\n\t\telse if(BrowserName.equals(&quot;FireFox&quot;))\n\t\t{\n\t\t\tSystem.setProperty(&quot;webdriver.gecko.driver&quot;, &quot;.\/Drivers\/geckodriver.exe&quot;);\n\t\t\tdriver = new FirefoxDriver();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(&quot;Sorry this browser is not supported !!&quot;);\n\t\t}\n\t\t\n\t\tdriver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);\n\t\tdriver.manage().window().maximize();\n\t\tdriver.get(appURL);\n\t\tdriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);\n\t\t\n\t\treturn driver;\n\t}<\/pre>\n\n\n\n<p>Now, we will create a method for browser quit having parameter driver. So when our script is completed than the browser will be quit automatically.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @author    Webkul\n * @copyright Copyright (c) 2010-2020 Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n\npublic static void QuitBrowser(WebDriver driver)\n\t{\n\t\tdriver.quit();\n\t}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Create a Class for Login Page<\/strong><\/h4>\n\n\n\n<p>We will now create all the elements which are on <strong>Login Page<\/strong> using <strong>@FindBy<\/strong> so we can directly call them using <strong>WebElement<\/strong>. Initialise all the elements together under the class so they can be accessible from anywhere.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @author    Webkul\n * @copyright Copyright (c) 2010-2020 Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n\n@FindBy(xpath =&quot;\/\/input&#091;@id=&#039;login_main_login&#039;]&quot;)\nWebElement username;\n\t\n@FindBy(xpath =&quot;\/\/input&#091;@id=&#039;psw_main_login&#039;]&quot;)\nWebElement password;\n\t\n@FindBy(xpath =&quot;\/\/body\/div&#091;@id=&#039;tygh_container&#039;]\/div&#091;@id=&#039;tygh_main_container&#039;]\/div&#091;3]\/div&#091;1]\/div&#091;2]\/div&#091;1]\/div&#091;1]\/div&#091;1]\/div&#091;1]\/form&#091;1]\/div&#091;3]\/div&#091;1]\/button&#091;1]&quot;)\nWebElement button;<\/pre>\n\n\n\n<p>Now create a method where all the <strong>WebElements<\/strong> of the<strong> Login Page<\/strong> will be called to perform some actions. In the method we will pass two parameters for username and password of the website.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @author    Webkul\n * @copyright Copyright (c) 2010-2020 Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n\npublic void loginto(String usrnme, String pswrd)\n{\n\tusername.sendKeys(usrnme);\n\tpassword.sendKeys(pswrd);\n\tbutton.click();\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Create a Class for Login Page<\/strong> Test<\/h4>\n\n\n\n<p>Now we will create another class where all other classes will be called. Before starting of a function we will call <strong>@Test<\/strong> which is used to run your script with <strong>TestNG<\/strong>.<\/p>\n\n\n\n<p>Create a void method and first call <strong>startapplication()<\/strong> method from <strong>BrowserFactory<\/strong> class to start the browser while passing parameters which are defined in the method. <\/p>\n\n\n\n<p>Create an object for <strong>Login Page<\/strong> with any name and initialise all <strong>WebElements<\/strong> using <strong>PageFactory<\/strong>. Now call the method where <strong>WebElements<\/strong> actions are defined under a method from an object which you have created.<\/p>\n\n\n\n<p>Now, call the method <strong>QuitBrowser()<\/strong> from the class <strong>BrowserFactory<\/strong> which is used to close the browser after your script.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @author    Webkul\n * @copyright Copyright (c) 2010-2020 Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n\npackage Webkul;\n\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.support.PageFactory;\nimport org.testng.annotations.Test;\n\npublic class LoginTest \n{\n\tWebDriver driver;\n\t\n\t@Test\n\tpublic void loginApp()\n\t{\n\t\tdriver = BrowserFactory.startapplication(driver, &quot;Chrome&quot;,          &quot;http:\/\/192.168.10.106\/login\/&quot;);\n\t\tLoginPage lgnpage = PageFactory.initElements(driver, LoginPage.class);\n\t\tlgnpage.loginto(&quot;test@webkul.com&quot;, &quot;admin&quot;);\n\t\tBrowserFactory.QuitBrowser(driver);\n\t}\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">View of Page Object Model(POM)<\/h4>\n\n\n\n<p>Now, if the AUT undergoes any change at the login page or at any page we just need to change the page object. Thus we don\u2019t need to change our test script again and again (even for the new release or built). <\/p>\n\n\n\n<p>The project structure will look like :<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"385\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/last-1200x385.png\" alt=\"POM_structure\" class=\"wp-image-271291\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/last-1200x385.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/last-300x96.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/last-250x80.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/last-768x247.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/last.png 1314w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>In case you have any queries then feel free to ask in the comment section below.<br>This is all about Page Object Model(POM) based Testing using Selenium WebDriver.<\/p>\n\n\n\n<p>Thanks for reading this blog.<\/p>\n\n\n\n<p>Happy testing!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Maintaining 1000 lines of code in a single class file is a heavy task and also it increases its complexity. In order to maintain the project structure and efficient performance of the selenium scripts, it is necessary to use different pages for different tasks. To ease the access of distributing the code into different <a href=\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":330,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2273,3138,5022,3250,3139],"class_list":["post-271049","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-automation","tag-selenium","tag-selenium-pom","tag-testing","tag-webdriver"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Page Object Model(POM) based Testing using Selenium WebDriver Webkul Blog<\/title>\n<meta name=\"description\" content=\"Page Object Model (POM) is a design pattern in Selenium that is used for reducing the code duplicacy and improves test case maintenance.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Page Object Model(POM) based Testing using Selenium WebDriver Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Page Object Model (POM) is a design pattern in Selenium that is used for reducing the code duplicacy and improves test case maintenance.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-20T12:14:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-10-20T12:14:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png\" \/>\n<meta name=\"author\" content=\"Ishan Malhotra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ishan Malhotra\" \/>\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:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/\"},\"author\":{\"name\":\"Ishan Malhotra\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/36cbd5a8947f497c32ae1ce661137038\"},\"headline\":\"Page Object Model(POM) based Testing using Selenium WebDriver\",\"datePublished\":\"2020-10-20T12:14:27+00:00\",\"dateModified\":\"2020-10-20T12:14:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/\"},\"wordCount\":845,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png\",\"keywords\":[\"Automation\",\"Selenium\",\"Selenium POM\",\"testing\",\"webdriver\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/\",\"url\":\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/\",\"name\":\"Page Object Model(POM) based Testing using Selenium WebDriver Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png\",\"datePublished\":\"2020-10-20T12:14:27+00:00\",\"dateModified\":\"2020-10-20T12:14:29+00:00\",\"description\":\"Page Object Model (POM) is a design pattern in Selenium that is used for reducing the code duplicacy and improves test case maintenance.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png\",\"width\":896,\"height\":341,\"caption\":\"1-5\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Page Object Model(POM) based Testing using Selenium WebDriver\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/36cbd5a8947f497c32ae1ce661137038\",\"name\":\"Ishan Malhotra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/12f0d4f8cd7624cecb33c8fb8dfd5c5ff2ebf31980495318e7abbdae6dce1915?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/12f0d4f8cd7624cecb33c8fb8dfd5c5ff2ebf31980495318e7abbdae6dce1915?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ishan Malhotra\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/ishan-malhotra855\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Page Object Model(POM) based Testing using Selenium WebDriver Webkul Blog","description":"Page Object Model (POM) is a design pattern in Selenium that is used for reducing the code duplicacy and improves test case maintenance.","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:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/","og_locale":"en_US","og_type":"article","og_title":"Page Object Model(POM) based Testing using Selenium WebDriver Webkul Blog","og_description":"Page Object Model (POM) is a design pattern in Selenium that is used for reducing the code duplicacy and improves test case maintenance.","og_url":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2020-10-20T12:14:27+00:00","article_modified_time":"2020-10-20T12:14:29+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png","type":"","width":"","height":""}],"author":"Ishan Malhotra","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ishan Malhotra","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/"},"author":{"name":"Ishan Malhotra","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/36cbd5a8947f497c32ae1ce661137038"},"headline":"Page Object Model(POM) based Testing using Selenium WebDriver","datePublished":"2020-10-20T12:14:27+00:00","dateModified":"2020-10-20T12:14:29+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/"},"wordCount":845,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png","keywords":["Automation","Selenium","Selenium POM","testing","webdriver"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/","url":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/","name":"Page Object Model(POM) based Testing using Selenium WebDriver Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png","datePublished":"2020-10-20T12:14:27+00:00","dateModified":"2020-10-20T12:14:29+00:00","description":"Page Object Model (POM) is a design pattern in Selenium that is used for reducing the code duplicacy and improves test case maintenance.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2020\/10\/1-5.png","width":896,"height":341,"caption":"1-5"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/page-object-modelpom-testing-using-selenium-webdriver\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Page Object Model(POM) based Testing using Selenium WebDriver"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/36cbd5a8947f497c32ae1ce661137038","name":"Ishan Malhotra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/12f0d4f8cd7624cecb33c8fb8dfd5c5ff2ebf31980495318e7abbdae6dce1915?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/12f0d4f8cd7624cecb33c8fb8dfd5c5ff2ebf31980495318e7abbdae6dce1915?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ishan Malhotra"},"url":"https:\/\/webkul.com\/blog\/author\/ishan-malhotra855\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/271049","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/330"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=271049"}],"version-history":[{"count":50,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/271049\/revisions"}],"predecessor-version":[{"id":271355,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/271049\/revisions\/271355"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=271049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=271049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=271049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}