SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Apprentice
    Join Date
    Mar 2002
    Location
    Sunnyvale, CA, USA
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Using IE object in test scripts

    I am currently evaluating test tools and am trying out some simple scripts. So far looks like I will go with Testpartner over Mercury etc.

    a) I have opened a IE browser using CreateObject. So I now have a object that references that browser.

    b) I can now use that object in calls to Navigate (object.Navigate) to a given URL, close browser (object.quit) etc

    I have two questions:

    1) How can I use that object in my scripts to enter text into a field or click on a button etc ie. HTMLEditBox

    2) My application will open a new window in some cases and close the original one. How can I get the new object for the window that has just been opened.

    Thanks for any help.

  2. #2
    Senior Member
    Join Date
    Sep 2001
    Location
    Philly
    Posts
    1,231
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using IE object in test scripts

    The object that you are creating is the IE Browser. It does not have knowledge of the html objects. If you add a reference to the "Microsoft Internet Controls" lib and then view this in the Object Browser... you will see everything you can do with the browser app.

    The MS HTML Object Library is where all of the HTMLObject stuff is. You can use this in class modules. See the folder "Sample Scripts" in the TP install directory.

    Finally... TP has the ablity to call the internal methods prop of objects via COM by using the .OBJECT method. To see what is available do this...

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">'highlight A, and 'Add Watch'
    set A = HTMLComboBox(&quot;Name=f&quot.object
    sleep 1 ' put a breakpoint on this line</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Now in the watch, you should be able to expand A and see all of the internal properties. So rather than the TP HTMLEditBox().SetText "Bob" you would do...

    HTMLEditBox("Name=search_words").Object.Value = "Bob"
    ~Alias~

  3. #3
    Apprentice
    Join Date
    Mar 2002
    Location
    Sunnyvale, CA, USA
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using IE object in test scripts

    Alias - Thanks for the info

    I have found how to keep track of the IE objects as browsers are opened and closed.

    Function IE_Find_Browser(Optional sTitle As String) As Object

    Dim sHapp As Object
    Dim oWin As Object
    Set sHapp = CreateObject("shell.application")
    On Error Resume Next
    For Each oWin In sHapp.windows
    If oWin.LocationName Like sTitle Or sTitle = "" Then
    Set IE_Find_Browser = oWin
    Exit For
    End If
    Next
    On Error GoTo 0

    Set oWin = Nothing: Set sHapp = Nothing

    If IE_Find_Browser Is Nothing Then
    LogFail "IE_Find_Browser", "Did not find Browser"
    End If

    End Function


    Above will either find the first IE / Explorer or if title passed then the one with that title (wild cards can be used)

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 08:03 PM.

Copyright BetaSoft Inc.