Forum Discussion

Xman1's avatar
Xman1
Occasional Contributor
7 years ago

How do i run the same Keyword Test on a different urls?

How do i run the same Keyword Test on a different urls?

 

For example:
I want to go to https://eoffice.epartconnection.com and fill in the login info and click submit.

Then, I want to go to https://eoffice.staging.epartconnection.com and preform the same test.

 

When I try this now it give me this error:

The test object was not found when executing the Click command:
Aliases.browser.pageEofficeEpartconnectionCom.formForm1.textboxStoreidtextbox

  • If you want to go in and change the value manually every time, use the project variable directions from your original thread:

    https://community.smartbear.com/t5/TestComplete-Functional-Web/Is-it-possible-to-run-a-data-loop-with-keyword-tests-inside-the/m-p/167436

     

    Then in your test, you will build the object name 

    "Aliases.browser." + myvariablename + ".formForm1.passwordboxPasswordtextbox" 

     

    and use eval to make it an actual object that you can enter text into or click or whatever.

     

    ------

     

    If you want to enter the value automatically and have the test run in a loop, you can put the URL values in a spreadsheet and at the top of the loop, read the URL into the project variable and the rest will be the same as above.

     

     

  • We answered your "different URLs" question in this thread and you accepted the solution:

    https://community.smartbear.com/t5/TestComplete-Functional-Web/Is-it-possible-to-run-a-data-loop-with-keyword-tests-inside-the/m-p/167449#M32833

     

    The error you are asking about now is something different.  

     

    "The test object was not found when executing the Click command" is telling you that TestComplete is trying to click something and it can't see it on the current page.

     

    Is Aliases.browser.pageEofficeEpartconnectionCom.formForm1.textboxStoreidtextbox the correct object to be clicking at this point in the test?

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      My guess is that in your NameMapping for your pageEofficeEpartconnectionCom, you have the URL hard coded to one or the other of the URL's you're using for testing.  You need to adjust this mapping.  Your best bet, given your URL's, is to use conditional mapping where you can indicate that the URL property value for the page can be one value OR another value.  Please see https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/managing/modifying/conditional-mapping-criteria.html

      • Xman1's avatar
        Xman1
        Occasional Contributor

        I did as told and went into the name mapping to add an or statement in which it takes in either URLs. 

        However, I was more looking for a solution that would swap out the domain for another one.

        for example:


        The object name for the password text box for the password input on the first website is 

        Aliases.browser.pageEofficeEpartconnectionCom.formForm1.passwordboxPasswordtextbox

         

        The object name for the other website is

        Aliases.browser.pageLocalhost65214.formForm1.passwordboxPasswordtextbox

         

        I would like to be able to freely swap out the underlined portions freely so that when I run the tests, the program can detect the objects properly.