Hot answers tagged

9

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 a personal testing framework as it creates a part of the underlying structure for your tests. but Data Driven because you always need to extract data from a ...


7

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 the fields are initialised. If you don't use the PageFactory, then NullPointerExceptions will be thrown if you make the assumption that the fields are ...


5

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 between methods and individual elements is not doable for larger pages, and it will make your test methods very long. My PageObjects usually have at least these same ...


4

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, which is if element is not visible on the viewport. So, I did this public waitForSpinnerDisappear(){ let EC = protractor.ExpectedConditions; browser.wait(EC....


3

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 implementation. You implement design patterns within frameworks - so you might use a keyword-driven framework with the Page Object Model, for example. Or a ...


2

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 needed. Make sure the tests are readable and describe the user behaviour. So in the example case you give, the user behavioural action is to login. So one ...


2

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've found out that having a complex Page Object defined as a node "package" (directory with index.js as a main entry point) with child page object exposed ...


2

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 plugins be configured as plugins not dependencies? Also seems like you should have other dependencies in test scope as well. Be sure to check that your test ...


2

This is not possible. Since Java annotations does not allow dynamic parameterization. For more details check this answer.


1

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 = instance.getDiver(); wait = instance.getWait(); } you get a reference to a static field instance = DriverInstance.getinstance(); that is basically you can read ...


1

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 value. A second TreeMap links properties to scraping methods. The data type is String but I could also use a TreeMap as the value type within the first Treemap, ...


1

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 the tell don't ask idiom. In this case use an expected data manager. Create a Batch class that reflects the expected data and pass this expectedData to the ...


1

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 project ,the required dependencies will get downloaded and again stored in your local repository(.m2).


1

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/introduction/introduction-to-the-lifecycle.html


1

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. Possibly provide reasonable defaults. PageObjects provide services for tests. Design them in a way so writing tests is easier. Encapsulate all the info about the ...


1

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 the design pattern type It helps to create Object Repository for UI elements In POM, for each web page in the application there should be corresponding page ...


1

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 partially do some behavioral driven testing. And also data driven with Apache POI or using DataProvider.


1

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 would do the job and can be customised to fit your needs. It could later be rolled into a service to support CI environments. By having a point that tests go ...


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