Ask a Question

Capturing dinamic values

olosunsira12
Occasional Contributor

Capturing dinamic values

Hello!!

 

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 1
tphillips
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?


--------------------
Senior SQA Automation Engineer
cancel
Showing results for 
Search instead for 
Did you mean: