jeudi 22 juin 2017

Generalize xpath for Web elements created in Page factory Model + selenium Java

I am working on selenium Page Factory model.I need to generalize the xpath in such a way it should be matching according to user requirement.

Let's say i have following xpath

@FindBy(xpath = "(//div[@class='del-hours' and contains(.,'Store #50')]//..//..//..//..//i)[2]")
WebElement selectStore;

I need this xpath should be used for Store#44 or Store #100 or anyother according to user input.

With regular old way of findElementBy i can able to achieve this. But i would like to know with page factory concept can we achieve this ?

Thanks

Aucun commentaire:

Enregistrer un commentaire