1

Consider the locator for an Element changes for different versions of the product. And we need to test both the versions of the product.

In this case I would like to use -

  1. Multiple locators to locate this single element. (like two different xpaths OR one xpath & one id)
  2. Use locator1 for version 1 and locator2 for version 2.

Can you suggest what would be good design to implement this? Is this possible to implement along with PageFactory?

I am looking for where I can provide two different types of locators. e.g. xpath and id. Also should I think of using object repository along with POM to run the test with two different product versions?

pavan kumar
  • 101
  • 7

2 Answers2

0

Yes it is possible to implement PageFactory for different versions.

We usually have a build tag in the class like build_tag = "ver1" or "ver2", you can put your different locators under different UI Map and call according to the version tag.

john
  • 413
  • 7
  • 16
0

There is also an option to add multiple conditions on the same locator using OR AND conditions in XPATH.

More detailed at W3 and example

Naveen
  • 770
  • 10
  • 22