How to select object like link with random changing structure?

Like in title, i need test activation mail, in this mail i have to click on object with random generate link. My question is, how can i do this, how to add this object to repo and use it?

you can add object dynamically using below code

public class CreateNewTestObject {

/**  
 \* Create new test object by Xpath  
 \* @param xpath  
 \* @return test object  
 */  
@Keyword  
public static TestObject byXpath(String xpath) {  
    TestObject to = new TestObject()  
    to.addProperty("xpath",ConditionType.EQUALS,xpath)  
    return to  
}  

}

1 Like

@5274-Rudra
Can you show me this for the example ?

Above it an exmaple it self. Let me know if you still haven’t implemented this. I can write in detailed

Open the email in a browser-based/web email client. Right click on the email link and choose Inspect. Right click on the element in the HTML and choose Copy XPATH.

Then define a Test Object in the Object Repository with xpath=‘the xpath goes here’. And use it in your test

WebUI.click(findTestObject('Your Test Object'))

Or use the XPATH to call @Rudra’s byXpath keyword.

WebUI.click(CustomKeywords.'CreateNewTestObject.byXpath'('xpath goes here'))