# How to select object like link with random changing structure?

**URL:** <https://forum.katalon.com/t/how-to-select-object-like-link-with-random-changing-structure/11402>\
**Category:** Web Testing\
**Tags:** web-testing, katalon-studio\
**Created:** [June 7, 2018, 8:41am UTC](https://forum.katalon.com/t/how-to-select-object-like-link-with-random-changing-structure/11402 "2018-06-07T08:41:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![karol\_chorzepa](https://avatars.discourse-cdn.com/v4/letter/k/ce73a5/32.png) [@karol\_chorzepa](https://forum.katalon.com/u/karol_chorzepa)\
**Post date:** [June 7, 2018, 8:41am UTC](https://forum.katalon.com/t/how-to-select-object-like-link-with-random-changing-structure/11402/1 "2018-06-07T08:41:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Rudra](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@Rudra](https://forum.katalon.com/u/Rudra)\
**Post date:** [June 7, 2018, 11:08am UTC](https://forum.katalon.com/t/how-to-select-object-like-link-with-random-changing-structure/11402/2 "2018-06-07T11:08:05Z")

</div>

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  
}  

```

}

---

<div class="post-metadata">

**Author:** ![karol\_chorzepa](https://avatars.discourse-cdn.com/v4/letter/k/ce73a5/32.png) [@karol\_chorzepa](https://forum.katalon.com/u/karol_chorzepa)\
**Post date:** [September 19, 2018, 10:51am UTC](https://forum.katalon.com/t/how-to-select-object-like-link-with-random-changing-structure/11402/3 "2018-09-19T10:51:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rudra](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@Rudra](https://forum.katalon.com/u/Rudra)\
**Post date:** [February 10, 2019, 6:46pm UTC](https://forum.katalon.com/t/how-to-select-object-like-link-with-random-changing-structure/11402/4 "2019-02-10T18:46:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Harold\_Owen](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/harold_owen/32/417_2.png) [@Harold\_Owen](https://forum.katalon.com/u/Harold_Owen)\
**Post date:** [February 10, 2019, 10:18pm UTC](https://forum.katalon.com/t/how-to-select-object-like-link-with-random-changing-structure/11402/5 "2019-02-10T22:18:57Z")

</div>

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'))`
