Forum Discussion

msudawg1987's avatar
msudawg1987
New Contributor
2 years ago

Using data driven keyword tests to open web pages - need advice

I am using TestComplete to create a keyword test that opens multiple web pages.  I am using a data loop to run through the URLs from an excel spreadsheet. 

 

If I use Navigate to open the web pages, it works to an extent.  All 5 URLs in the excel spreadsheet do open but it uses the same web session so after the test completes, only the last URL is actually open.  I want all 5 to be open once the test completes.  I don't care if there are 5 tabs or 5 browser sessions, but I want to see all 5 once it's finished.  Is there a way to have all 5 open once the test completes? 

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You will have to open a new tabe, then navigate to the the URL. Then open a second tab, navigate to the URL etc. Pressing Ctrl + T will open a new tab in Chrome

    • msudawg1987's avatar
      msudawg1987
      New Contributor

      How do you add a Ctrl + T to the keyword test?  I am reading the URLs from a data loop using an excel spreadsheet, I am not seeing how to add this step to my loop.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I'm guessing it will be an on-screen action followed by keys.

  • stefanheisl's avatar
    stefanheisl
    New Contributor

    Hey msudawg1987,

     

    I've encountered a similar situation before while working with TestComplete and data-driven keyword tests. It can indeed be frustrating when you want to open multiple web pages, but they end up in the same session, displaying only the last URL. Here's a solution that might work for you:

     

    Instead of using the "Navigate" action directly, you can create a loop in your keyword test. Inside the loop, perform the following steps:

     

    1. Open a new tab or browser session (as you mentioned, you can use Ctrl + T in Chrome).
    2. Navigate to the URL from your Excel spreadsheet.
    3. Repeat these steps for each URL in your list.

     

    By opening new tabs or sessions for each URL within the loop, you should achieve the desired result of having all 5 web pages open simultaneously when the test completes. This way, you'll have multiple tabs or browser sessions, each displaying a different URL.