Forum Discussion

Tate7918's avatar
Tate7918
New Contributor
8 years ago

Object Identification: Page name changes, field name does not

Hi!

I'm new to TC and struggling with coming up with a solution to ambiguous object names.

 

Basically, I need to "scrape" the value of a specific field on a web page. The field is, regardless of the page, called 'Cell0123'.

The issue, however, is that the page name changes each time the test is run. 

 

For example:

Test Run 1:

Object path = Aliases.browser.Pam.Cell0123

 

Test Run 2:

Object path = Aliases.browser.Charlie.Cell0123

 

In order to return the value of the cell, I am using CallObjectMethod, then innerText[Get].

 

I basically need to tell TC that the page name itself doesn't matter, just the cell name. 

Something like: Aliases.browser.*.Cell0123

 

This is currently running as a keyword test and I'd like it to continue to if possible.

 

Is this possible? Better way to do this?

 

Thanks!

  • You can use * in the namemapping criteria for your page.

     

    Say your two pages are test.1.example.com and test.2.example.com. 

     

    In your namemapping for the url property of the mapped page, you can change it to test.*.example.com

  • cunderw's avatar
    cunderw
    Community Hero

    You can use * in the namemapping criteria for your page.

     

    Say your two pages are test.1.example.com and test.2.example.com. 

     

    In your namemapping for the url property of the mapped page, you can change it to test.*.example.com

    • Tate7918's avatar
      Tate7918
      New Contributor

      Thank you for your reply. 

      It took some trial and error to figure out exactly where to update the URL mapping, but I was able to get it to work and get the alias names to be friendlier as well.

       

      Accepting as answer.