Forum Discussion

olosunsira12's avatar
Occasional Contributor
4 years ago

Capturing dinamic values



I have this web object: 

Aliases.browser.pageSearchresultsEs.FindElement("//h1[contains(text(), 'Málaga: 413 alojamientos encontrados')]").ContentText


Every time I run the test case the web object changes .(ex: now is  Aliases.browser.pageSearchresultsEs.FindElement("//h1[contains(text(), 'Málaga: 413 alojamientos encontrados')]").ContentText but next time could be Aliases.browser.pageSearchresultsEs.FindElement("//h1[contains(text(), 'Málaga: 410 alojamientos encontrados')]").ContentText


Is there a way to capture the number dinamically?  

I need to show the result so I'm using this:


BuiltIn.ShowMessage(Aliases.browser.pageSearchresultsEs.FindElement("//h1[contains(text(), 'Málaga: 413 alojamientos encontrados')]").ContentText)



1 Reply

  • tphillips's avatar
    Frequent Contributor

    Is that the only header on the page? Also what if you change the string it's looking for to just "alojamientos encontrados" so it's ignoring the number altogether?