How to use LeanFT to click a link with dynamic properties
Question ID: 106384
1
0

We are using LeanFT in Visual Studio. I need to figure out how to identify a dynamic link. The link changes based on how many records are available in the database.

Using Amazon’s Cart link as an example, if we have 20 items in the cart, the link innertext would be "Cart20"

Since the number can vary, I need to find some way to click the link no matter what the number is.

Marked as spam
Posted by (Questions: 387, Answers: 66)
Asked on September 15, 2015 6:06 pm
371 views
Answers (1)
1
Private answer

You can use a regular expression in the property value.

Using Amazon, I put 20 objects in the cart. This is the cart properties with 20 objects:

browser.Describe(new LinkDescription
{
TagName = @''A'',
InnerText = @''Cart0''
});

Using a regular expression, you can tell it to look for the Cart link with any value after it like this:

var cartlink = browser.Describe(new LinkDescription
{
TagName = @''A'',
InnerText = As.RegExp(@''Cart.*'')
});

If you were using Eclipse, you can do the same thing. Here's the syntax:

.idProp(new RegExpProperty(''RegExpValue'')

Marked as spam
Posted by (Questions: 17, Answers: 807)
Answered on September 15, 2015 6:07 pm
0
That's very helpful! Thanks!
( at September 15, 2015 6:08 pm)
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top