Go to All Forums

Web Transaction (Browser) - Dynamic LInks

How to do I address dynamic links when using the Web Transaction Monitor. 

 

For example, in the step below, the XXXXX represents dynamic content. 

 

begin_step("Step - 1 : click A", "site.com/cartpreview#cart_item_remove_XXXXX")
click_element_by_linktext("Remove", "", "#SEP#linkText=Remove#SEP#css=a.secondary_link#SEP#css=.table__label__note > .secondary_link#SEP#xpath=//a[contains(text(),'Remove')]#XPATH#//div[@id='barba-wrapper']/div/main/div[2]/div/div/table/tbody/tr/td[3]/div/a#XPATH#//a[contains(@href, '#cart_item_remove_XXXXX')]#XPATH#//td[3]/div/a#XPATH##SEP#")

Like (2) Reply
Replies (4)

Hi there,
Thank you for writing to us. A quick question..  Are all html attributes (like id, name, css, xpath) dynamic?

-Jasper

PM, Site24x7

Like (0) Reply

no, only what I highlighted in red, which is part of a hyperlink. 

Like (0) Reply

Dear Marin,

  In the above example which you have given, since in the script click_element_by_linktext is the first call, we will check linktext attribute with value as "Remove" first and try to perform that action. If that fails, we will perform action on css or xpath. Intelligent playback does this logic and more. 

Can you elaborate on the problem you are facing. Ideally if only a part of the content is dynamic it should work. 

-Jasper

PM, site24x7

 

 

 

 

Like (0) Reply

That's good to know. Thanks.

The issue I am having is not finding the "Remove" text 

Unable to locate element "linktext=Remove"

I did notice my element text has 2 leading whitespaces , so not sure if that's causing an issue. see below :

<div class="table__label__note">

                                    <a href="#cart_item_remove_6aa7fc466f1a420db73e421f1b687eb6" data-behavior="OverlayLink" class="secondary_link">Remove  </a>

                                </div>

 

I also tried removing the dynamic content from the Script since it "contains" the other value but I got the same error. 

 

Like (0) Reply

Was this post helpful?