mercredi 28 août 2019

How to change By class at runtime to generate dynamically changing xpath?

In my current framework locators of By class are being changed dynamically say for suppose ok and cancel have same xpath expression except the text Ok and one has text cancel in it then it uses a method called

findElement(driver,generateDynamicPageElements(By b,String s));

where b definition is

By b = By.xpath("//button[text()='{param1}']");

And

s="OK";

Then at runtime it changes the functionality and turns into findElement(driver,By.xpath("//button[text()='OK']")); finds button with text OK how can I achieve it? Since the functionality of generateDynamicPageElement is hidden so I needed to ask this question.





Aucun commentaire:

Enregistrer un commentaire