Hot answers tagged

9 votes

What framework is Page Object Model

The PageObject Model is not a framework. A framework is: a basic structure underlying a system The Page Object Model is: an object repository design pattern here. Using the POM might result in ...
Niels van Reijmersdal's user avatar
7 votes
Accepted

POM vs PageFactory

I think the Page Factory is an extension of the Page Object Model. This Selenium documentation page describes with examples what the Factory adds. If you use the PageFactory, you can assume that ...
Niels van Reijmersdal's user avatar
6 votes

What is the most standard way to use POM in Selenium?

If you think about what a method actually is (a procedure specific to that class to achieve a certain result or get a value) then I would use a single Login method. Having a one-on-one relation ...
FDM's user avatar
  • 5,904
4 votes
Accepted

Correct Strategy for Element to be not present in DOM

After a long hard fought battle, I was able to overcome this using opposite of what K-8 had suggested. Instead of checking if an element is visible on the viewport, I checked the negative of that, ...
demouser123's user avatar
  • 3,532
3 votes

What is the most standard way to use POM in Selenium?

Only program the actions (class methods) you really need. Apply the YAGNI principle. Don't write code you think you might need in the future, this will only add maintenance as you write more code than ...
Niels van Reijmersdal's user avatar
3 votes

Design patterns specific for test automation

This is probably not a design pattern but more like an organizational/structural pattern. When having a big test codebase and following the Page Object pattern for WebDriverJS/Protractor testing, we'...
3 votes

What framework is Page Object Model

As others have said, the Page Object Model is a design pattern which helps to avoid repeated code. A Framework is a code platform providing a base set of generic functionality and guidelines for ...
Kate Paulk's user avatar
  • 31.5k
3 votes

How to send variable (dynamic value) at @findby in POM using java

This is not possible. Since Java annotations does not allow dynamic parameterization. For more details check this answer.
Alexey R.'s user avatar
  • 11.6k
2 votes

java.lang.NullPointerException on my POM project. I have my Page factories initialized and cant figure out the issue

You haven't loaded your file to properties object hence you get null when try to obtain a property value. Your code should look like public TestBase() { try { prop = new ...
Alexey R.'s user avatar
  • 11.6k
2 votes

How to plan selenium automation of webapplication when more than 1 person is involved

Another way to phrase this question is, "How do multiple developers use the same code base in their work?" Selenium automation is just using an open source library to set up testing. It's ...
Lee Jensen's user avatar
  • 2,131
2 votes

What is the purpose of creating a BaseTest class which declares a global static WebDriver object in POM framework?

In your code, I think you have mixed two approaches together. Using Base Class Without Using Base Class In Approach 1: You don't have to assign a driver to a local variable if you are using a base ...
PDHide's user avatar
  • 11.1k
2 votes

Why is WebDriver instance declared static in Page Object model structure in Selenium?

Basically you do not even need to store your driver reference in page class field unless you access some driver-specific features within the logic of your page class (like accessing page title, window ...
Alexey R.'s user avatar
  • 11.6k
2 votes
Accepted

How to handle AB testing approach with similar page logic but different locators

The create separate page objects for the new environment can work well if you use polymorphism appropriately. I would suggest understanding Dave Farley's DSL + Protocol Driver architecture (short ...
João Farias's user avatar
  • 10.9k
2 votes

testng.xml is not executing when we run pom.xml for maven project selenium

The testng.xml should be located in your test resources. That way the testng.xml will be copied. You can also configure surefire plugin to explicitly run testng suite xml files. Should your maven ...
Aulis Ronkainen's user avatar
1 vote
Accepted

How to pass locale to page object models?

For a test, I'd like to validate some texts I wouldn't mix the responsibilities of modeling the interactions with the page (page objects) with asserting the values (responsibility of the tests). And ...
João Farias's user avatar
  • 10.9k
1 vote

How to pass locale to page object models?

If its page object model then the functions for getting and returning the country should be local to each page's class- similar to each page objects GoTo() function, you could implement a GetCountry() ...
bobdaduck's user avatar
1 vote

How to use explicit wait in POM selenium

The Page Object pattern is about creating an API for your pages, to create functions named after actions you can take in the page. Naturally, to perform certain actions, you need to wait certain ...
João Farias's user avatar
  • 10.9k
1 vote

Appium Pagefactory throws noSuchMethodException when running from POM

it's a bit embarrassing, (because i remembered I did this before) After doing an mvn clean, and an mvn compile again, Then the issue disappeared. something probably got stuck somewhere and needed a ...
Jano's user avatar
  • 113
1 vote
Accepted

Should Page Objects be reused or should new ones be created?

there is a best practice when "There are good practices in context, but there are no best practices." When you first create the LoginPage object, it has the context of the first landing on ...
João Farias's user avatar
  • 10.9k
1 vote

Advices/Best practices/Validity on selenuim page object model

I don't think it is the best practice to pass your web-Driver as a parameter and pass it to every single method. Don't create method for returning the web-Elements , Instead Use PageFactory or your By ...
abishek kachroo's user avatar
1 vote

Why is WebDriver instance declared static in Page Object model structure in Selenium?

Using static will make the scope class level, else the scope will be the object level. You cannot share the state between classes You can use base class driver instance by inheriting it or by calling ...
PDHide's user avatar
  • 11.1k
1 vote

How to resolve NullPointerException error while implementing POM with cucumber framework

I am not sure that you have provided a proper code or you have right understanding of where your exception appears. As per your code: { instance = DriverInstance.getinstance(); driver = ...
wec's user avatar
  • 409
1 vote

How to abstract data classes to be more object oriented?

Java's built in Function interface allows me to avoid using getters. Instead of hardcoding each property in a separate field, I use a TreeMap to hold all the properties as property name and property ...
John's user avatar
  • 111
1 vote

How to abstract data classes to be more object oriented?

You are right to be concerned about getters/setters; they are an anti-pattern in OOP and should be avoided because they result in more tightly coupled code. Instead invert the responsibility by using ...
Martin Spamer's user avatar
1 vote

Clean pom.xml from all not used dependencies

Delete .m2 folder which contains all the dependencies form your user-home.Then re-build your package using "mvn clean package" command.All your dependencies will be removed and when you run a maven ...
shanila's user avatar
  • 491
1 vote

Unable to run cucumber tests from command line

mvn clean means you're executing the clean phase of maven which would not run any tests. You should probably try test or verify, e.g. mvn clean verify. More to read: https://maven.apache.org/guides/...
Mykola Gurov's user avatar
1 vote

What is the most standard way to use POM in Selenium?

If controls are used only together (it does not make sense to fill/click one but not the other), handle them in a single method. If they can be used separately, handle them in separate methods. ...
Peter M. - stands for Monica's user avatar
1 vote

What framework is Page Object Model

I can see you are getting little confuse between Page Object Model and Data driven/Hybrid. Below small info might help to understand basic - What framework is Page Object Model? Simply its one of ...
Narendra Chandratre's user avatar
1 vote

What framework is Page Object Model

We often call POM a framework but its mostly is a design pattern/class style to create object repository. You can make it Hybrid by adding even other testing process... like- adding cucumber-jvm to ...
Sayed's user avatar
  • 41
1 vote

keep test data of json format in pom patterm

At this point its worth building a user data generator that can be used to provide coherent sets of login data and credentials for your tests. Something like faker https://github.com/DiUS/java-faker ...
Amias's user avatar
  • 1,202

Only top scored, non community-wiki answers of a minimum length are eligible