| || |
Using LR 11 patch 3. VuGen scripting with TruClient protocol. Client WS is win 7 32 bit OS for scripting.
However, what if each link has unique value for each returned result. For example:
<a href="/iac/viewItem.do?alertID=4n2ka2c4=" ID="actionDefault_0">Test</a>
There are about 10 results returned with different alertIDs and actionDefaults. What I want is get all of them and put them into an collection then do the random thing, but I can't get document.querySelectorAll()to work. I can only get one-at-a-time.
Any help would be great!
In this case would regular expessions work?
I guess I should have added more information.
If you remember from the truClient tips and tricks:
made no sense. However, a bit of research I came up with the following:
var my_links = document.querySelectorAll("#TableResult>tbody&g t;tr>td:nth-of-type(1)>a");
my_links[Math.floor(Math.random() * my_links.length)];
The above works like a charm. Actually XPath kind of helped me with location.
Hope someone can use this...
Great find.. I do have one related statement.
I have found that many times if the statement has an Argument section with an Ordinal option you can change the Ordinal to a 0 (zero) and TruClient will do the work for you on selecting an random option.
For those statements that did not have an Ordinal option I was often times able to choose Alternative Steps and find one that did have the Ordinal option.
This is a much easier approach if it is available to you. If not then the tips and tricks technique is the fall back. I only wish there was more documentation on discovering and using the DOM.