{"id":578,"date":"2026-05-23T06:22:13","date_gmt":"2026-05-23T06:22:13","guid":{"rendered":"https:\/\/logicnextgen.com\/tutorials\/?page_id=578"},"modified":"2026-05-24T08:49:52","modified_gmt":"2026-05-24T08:49:52","slug":"page-object-model-pom-questions-answers","status":"publish","type":"page","link":"https:\/\/logicnextgen.com\/tutorials\/page-object-model-pom-questions-answers\/","title":{"rendered":"Page Object Model Interview Questions &amp; Answers"},"content":{"rendered":"\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-daab6eee589ec5be9886140f45068dd6\" style=\"color:#ff8d00\"><strong>1. What is Page Object Model (POM)?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Page Object Model is a design pattern in Selenium automation where each web page is represented as a separate class.<br>The class contains:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Web elements of the page<\/li>\n\n\n\n<li>Methods to perform actions on those elements<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">It helps improve:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Code reusability<\/li>\n\n\n\n<li>Maintainability<\/li>\n\n\n\n<li>Readability<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-fe835a9568c38dc6c9a3c383bd2308a4\" style=\"color:#ff8d00\"><strong>2. Why do we use POM in Selenium?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">POM is used to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reduce code duplication<\/li>\n\n\n\n<li>Separate test logic from page elements<\/li>\n\n\n\n<li>Make framework easy to maintain<\/li>\n\n\n\n<li>Handle UI changes easily<\/li>\n\n\n\n<li>Improve scalability of automation framework<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-70dedd44a74a6d5300e9322c035edfd0\" style=\"color:#ff8d00\"><strong>3. What are the main components of POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Main components are:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Page Class<\/strong> \u2192 Contains locators and methods<\/li>\n\n\n\n<li><strong>Test Class<\/strong> \u2192 Contains test cases<\/li>\n\n\n\n<li><strong>Object Repository<\/strong> \u2192 Stores web element locators<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-fdfcaa4a3f28b1e0b5f04de4f482d594\" style=\"color:#ff8d00\"><strong>4. What are the advantages of POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Advantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Better code organization<\/li>\n\n\n\n<li>Easy maintenance<\/li>\n\n\n\n<li>Reusable methods<\/li>\n\n\n\n<li>Improved readability<\/li>\n\n\n\n<li>Reduced duplication<\/li>\n\n\n\n<li>Easy debugging<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-5daafe5dfdf1969861cdb1f7ba64dcd4\" style=\"color:#ff8d00\"><strong>5. What are the disadvantages of POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Disadvantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Initial setup takes time<\/li>\n\n\n\n<li>More classes need to be created<\/li>\n\n\n\n<li>Not suitable for very small projects<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-caf33a91495e65523b176e9c187bff23\" style=\"color:#ff8d00\"><strong>6. How does POM improve maintainability?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If a locator changes in UI, we update it only in the Page Class instead of updating in all test cases.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-c8b36f741ee7359283e44b7ba5601f92\" style=\"color:#ff8d00\"><strong>7. What is Page Factory in Selenium?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Page Factory is an inbuilt Selenium class used to implement POM easily using annotations like @FindBy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@FindBy(id=\"username\")\nWebElement userName;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-61e6958b067d50e8990efe6fc3e751bd\" style=\"color:#ff8d00\"><strong>8. Difference between POM and Page Factory?<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>POM<\/strong><\/td><td><strong>Page Factory<\/strong><\/td><\/tr><tr><td>Uses normal findElement()<\/td><td>Uses @FindBy annotations<\/td><\/tr><tr><td>Elements initialized manually<\/td><td>Elements initialized automatically<\/td><\/tr><tr><td>More coding required<\/td><td>Less coding required<\/td><\/tr><tr><td>Slower compared to Page Factory<\/td><td>Faster initialization<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-702642dae9add162291e71d90916cab5\" style=\"color:#ff8d00\"><strong>9. What is the use of @FindBy annotation?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">@FindBy is used to locate web elements in Page Factory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@FindBy(xpath=\"\/\/input&#91;@id='email']\")\nWebElement email;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-c2963b0806ad93943e22f263d0cbbb99\" style=\"color:#ff8d00\"><strong>10. What is PageFactory.initElements()?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">It initializes all web elements present in the Page Class.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PageFactory.initElements(driver, this);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-3c5fb51d7499a0717ac0bb2788cc6dd0\" style=\"color:#ff8d00\"><strong>11. How do you create a Page Class in POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class LoginPage {\n\u00a0\u00a0\u00a0WebDriver driver;\n\u00a0\u00a0\u00a0@FindBy(id=\"username\")\n\u00a0\u00a0\u00a0WebElement username;\n\u00a0\u00a0\u00a0@FindBy(id=\"password\")\n\u00a0\u00a0\u00a0WebElement password;\n\u00a0\u00a0\u00a0@FindBy(id=\"login\")\n\u00a0\u00a0\u00a0WebElement loginBtn;\n\u00a0\u00a0\u00a0LoginPage(WebDriver driver){\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0this.driver = driver;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0PageFactory.initElements(driver, this);\n\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0public void login(String user, String pass){\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0username.sendKeys(user);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0password.sendKeys(pass);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0loginBtn.click();\n\u00a0\u00a0\u00a0}\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-acf251e8f0b133d214c6cc7cefb8d353\" style=\"color:#ff8d00\"><strong>12. What is the role of constructor in POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Constructor is used to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Initialize WebDriver<\/li>\n\n\n\n<li>Initialize web elements using PageFactory<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-64b307ce7cadd057a1dbe64a08a453eb\" style=\"color:#ff8d00\"><strong>13. Why should test data not be stored in Page Classes?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Page Classes should only contain page elements and methods.<br>Test data should be stored separately for better maintainability.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-d8d4610c23d596e57ea4aacdcfbfa7d2\" style=\"color:#ff8d00\"><strong>14. Can we use POM without Page Factory?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes.<br>We can implement POM using normal findElement() methods without using Page Factory.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-f073f650d00fca3beb760186efc582f5\" style=\"color:#ff8d00\"><strong>15. What is the difference between Page Class and Test Class?<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Page Class<\/strong><\/td><td><strong>Test Class<\/strong><\/td><\/tr><tr><td>Contains locators and methods<\/td><td>Contains test cases<\/td><\/tr><tr><td>Represents webpage<\/td><td>Executes validations<\/td><\/tr><tr><td>Reusable<\/td><td>Uses page methods<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-aa60dcf090de031955118de47fab7ed4\" style=\"color:#ff8d00\"><strong>16. How does POM support reusability?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Common methods like login, click, search, etc. can be reused across multiple test cases.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-7886779caedc59e89c8e0e7cc1feb04a\" style=\"color:#ff8d00\"><strong>17. What type of framework commonly uses POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">POM is commonly used in:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Hybrid Framework<\/li>\n\n\n\n<li>Data-Driven Framework<\/li>\n\n\n\n<li>Keyword-Driven Framework<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-4141e9085c7585855a1af5a727641e76\" style=\"color:#ff8d00\"><strong>18. What are best practices in POM?<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Keep locators private<\/li>\n\n\n\n<li>Use meaningful method names<\/li>\n\n\n\n<li>Avoid hard coding<\/li>\n\n\n\n<li>Use reusable methods<\/li>\n\n\n\n<li>Maintain separate test and page classes<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-5c999c422816040b0050ac5ee5f7df6f\" style=\"color:#ff8d00\"><strong>19. What is Object Repository in POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Object Repository is a place where all web element locators are stored.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@FindBy(id=\"login\")\nWebElement loginBtn;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-1a6eacd641e53cdadb9c8cbf4e9b3df3\" style=\"color:#ff8d00\"><strong>20. How do you handle dynamic elements in POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Dynamic elements can be handled using:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Dynamic XPath<\/li>\n\n\n\n<li>Explicit waits<\/li>\n\n\n\n<li>Relative locators<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@FindBy(xpath=\"\/\/button&#91;contains(text(),'Login')]\")\nWebElement loginBtn;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-9c36318e5c6e9d39d70f16729f6f6fd1\" style=\"color:#ff8d00\"><strong>21. Can POM be used with TestNG?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes.<br>POM is commonly integrated with TestNG for test execution, assertions, and reporting.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-96fa551a198491ee3e3140d137b227b5\" style=\"color:#ff8d00\"><strong>22. Why is POM considered a good design pattern?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Because it follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Separation of concerns<\/li>\n\n\n\n<li>Encapsulation<\/li>\n\n\n\n<li>Reusability<\/li>\n\n\n\n<li>Maintainability<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-30e50851acf57eea7cdefc09d92309f6\" style=\"color:#ff8d00\"><strong>23. What is encapsulation in POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Web elements are hidden inside Page Classes and accessed only through methods.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public void clickLogin(){\n\u00a0\u00a0\u00a0loginBtn.click();\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-8184499d27ee774aaec9244c5e29aa67\" style=\"color:#ff8d00\"><strong>24. How do you manage waits in POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Waits are usually implemented inside page methods using Explicit Wait.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));\nwait.until(ExpectedConditions.visibilityOf(loginBtn));<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-58f672b0833bace0aab9748a2b484330\" style=\"color:#ff8d00\"><strong>25. What is the folder structure in a POM framework?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Typical structure:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">src\/test\/java<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;\u251c\u2500\u2500 pages<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;\u251c\u2500\u2500 tests<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;\u251c\u2500\u2500 utilities<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;\u251c\u2500\u2500 base<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;\u2514\u2500\u2500 reports<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/logicnextgen.com\/tutorials\/wp-content\/uploads\/2026\/05\/image-1-1024x683.png\" alt=\"\" class=\"wp-image-678\" srcset=\"https:\/\/logicnextgen.com\/tutorials\/wp-content\/uploads\/2026\/05\/image-1-1024x683.png 1024w, https:\/\/logicnextgen.com\/tutorials\/wp-content\/uploads\/2026\/05\/image-1-300x200.png 300w, https:\/\/logicnextgen.com\/tutorials\/wp-content\/uploads\/2026\/05\/image-1-768x512.png 768w, https:\/\/logicnextgen.com\/tutorials\/wp-content\/uploads\/2026\/05\/image-1.png 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-a45cdfe14269316e313e16de073d5709\" style=\"color:#ff8d00\"><strong>26. How do you handle multiple pages in POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create separate Page Classes for each webpage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>LoginPage.java<\/li>\n\n\n\n<li>HomePage.java<\/li>\n\n\n\n<li>CartPage.java<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-c0b94d9f849fd2c47c7cd81e7b4f4369\" style=\"color:#ff8d00\"><strong>27. What is Base Class in POM framework?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Base Class contains common setup code like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Browser launch<\/li>\n\n\n\n<li>Driver initialization<\/li>\n\n\n\n<li>Wait setup<\/li>\n\n\n\n<li>Common utilities<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-708af516dd0b4b250602c1506cf6df52\" style=\"color:#ff8d00\"><strong>28. What are reusable methods in POM?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Methods that can be used multiple times across tests.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">click()<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sendKeys()<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">selectDropdown()<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-b6730863175c998adb060321960c3aca\" style=\"color:#ff8d00\"><strong>29. How is POM useful in large projects?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In large projects:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>UI changes happen frequently<\/li>\n\n\n\n<li>Multiple testers work together<\/li>\n\n\n\n<li>Reusable components are needed<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">POM helps manage all these efficiently.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-f8a0b3cb5cb0b109f42528d4b337e051\" style=\"color:#ff8d00\"><strong>30. Explain real-time usage of POM.<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In real projects:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Every page has separate class<\/li>\n\n\n\n<li>Test cases call page methods<\/li>\n\n\n\n<li>Framework becomes modular and scalable<\/li>\n\n\n\n<li>Maintenance becomes easier when UI changes occur<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. What is Page Object Model (POM)? Page Object Model is a design pattern in Selenium automation where each web page is represented as a separate class.The class contains: It helps improve: 2. Why do we use POM in Selenium? POM is used to: 3. What are the main components of POM? Main components are: &#8230; <a title=\"Page Object Model Interview Questions &amp; Answers\" class=\"read-more\" href=\"https:\/\/logicnextgen.com\/tutorials\/page-object-model-pom-questions-answers\/\" aria-label=\"Read more about Page Object Model Interview Questions &amp; Answers\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-578","page","type-page","status-publish"],"_links":{"self":[{"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/pages\/578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/comments?post=578"}],"version-history":[{"count":7,"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/pages\/578\/revisions"}],"predecessor-version":[{"id":679,"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/pages\/578\/revisions\/679"}],"wp:attachment":[{"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/media?parent=578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}