Click random link from list of objects

Hey Guys,

suppose i have following HTML

<ul>
   <li><a>Test 1</a></li>
   <li><a>Test 2</a></li>
   <li><a>Test 3</a></li>
</ul>
<ul>
   <li><a>Test 4</a></li>
   <li><a>Test 5</a></li>
   <li><a>Test 6</a></li>
</ul>
<ul>
   <li><a>Test 7</a></li>
   <li><a>Test 8</a></li>
   <li><a>Test 9</a></li>
</ul>

I have this “//ul/li/a” xpath to capture all anchor tag. so now i want to click any anchor tag randomly.

can i store those all anchor tag as a TestObject into array list ?

please give any solution for that.

in OR define object with xpath:
//ul/li/a[${IDX}]

then in code simply use :

findTestObject(‘path/to/object’,[(‘IDX’): x])

where x is random number

1 Like

thanks! Andrej Podhajský