-2

I'm trying to just open http://espn.go.com/ and then click on the "NBA" tab using TestComplete.

Could someone tell me how to do this to get me started?

Thanks!

Xan
  • 74,770
  • 16
  • 179
  • 206

4 Answers4

1

In the example below, you need a unique property name and value of the tab you want to click to be able to find it on the page. You can find this by clicking the tab using the Object Spy tool in test complete.

function nbaTest(){

    var nbaTab;

//open browser at espn page

  Browsers.Item("iexplore").Run("http://espn.go.com");

//search page for nba tab using a unique property name and corresponding property value    of the nba tab

 nbaTab = Sys.browser('iexplore').page("*").Find(propertyName,propertyValue,"1000","TRUE");

    if (nbaTab.exists){
        nbaTab.click();
    }
        else{
            Log.Warning("NBA tab not found");
            return;
        }

}
bjb568
  • 11,089
  • 11
  • 50
  • 71
Chris B
  • 51
  • 4
0

I've tried using TestComplete' Recording feature - the script looks reliable. This is what was recorded:

  var page;
  Browsers.Item(btIExplorer).Navigate("http://espn.go.com/");
  page = Aliases.browser.Page("http://espn.go.com/");
  page.Panel(1).Panel("content").Panel("nav_wrapper").Panel("nav_wrapper_container").Panel("nav_main").Link("lpos_sitenavdefault_lid_sitenav_nba").Click();
Tanya
  • 226
  • 1
  • 5
0

Keyword test to open http://espn.go.com/ and then click on the "NBA" tab:

Steps:

  1. Run TestComplete (I'm using version 10)
  2. Launch the recording (By clicking "Record New Test" or "Append to Test")
  3. Open IE and type the URL http://espn.go.com/ on address bar -> Click NBA tab -> Close the browser
  4. Stop recording and see the KeywordTest you recorded in TestComplete IDE

My KeywordTest I recorded was as below:

Run Browser Parametrized (Internet Explorer, "", pX64)  "http://espn.go.com/", ...  Launches the specified browser and opens the specified URL in it.
pageEspnTheWorldwideLeaderInSpor    Wait        Waits until the browser loads the page and is ready to accept user input.
linkTennisM HoverMouse  0, 0    Moves the mouse pointer over the 'linkTennisM' control.
pageEspnTheWorldwideLeaderInSpor    Wait        Waits until the browser loads the page and is ready to accept user input.
panelModContainerModTabsModNoFoo    ClickTab    "NBA"   Selects the 'NBA' tab of the 'panelModContainerModTabsModNoFoo' tab control.
linkNba HoverMouse  8, 6    Moves the mouse pointer over the 'linkNba' control.
panelHeader HoverMouse  658, 25 Moves the mouse pointer over the 'panelHeader' control.
ToolbarWindow32 ClickItemXY "&File", 16, 8, false   Clicks at point (16, 8) of the '&File' item of the 'ToolbarWindow32' toolbar.
PopupMenu   Click   "Exit"  Moves the mouse cursor to the menu item specified and then simulates a single click.
Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
0

Not sure if this will help but you might be able to automate the step of opening your browser as well.

I use:

Call Sys.OleObject("WScript.Shell").Exec("cmd /c start /MAX iexplore ""http://espn.go.com""")

From there, you can automate the rest as usual (might need to wait for the page to load here as well).