How to use LeanFT to click a link with dynamic properties

  • Questions
  • 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: 338, Answers: 20)
Asked on September 15, 2015 6:06 pm
21 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: 16, Answers: 748)
Answered on September 15, 2015 6:07 pm
That's very helpful! Thanks!
( at September 15, 2015 6:08 pm)