SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Jul 2007
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Browser object issue in programmatic description

    Hy,

    Considering the following lines of code :

    <font class="small">Code:</font><hr /><pre>
    Sub GetPageReference(oBrowser, ByRef oPage)
    Dim title,hwnd
    hwnd = oBrowser.hwnd
    title = Browser("hwnd:="&amp;hwnd).GetROProperty("title")
    Set oPage = Browser("title:="&amp;title,"hwnd:="&amp;hwnd).Pag e("title:="&amp;title)
    End Sub


    Dim browser1,browser2
    StartBrowser browser1
    StartBrowser browser2

    browser1.Navigate "URL"
    browser2.Navigate "URL"

    Dim pageRef1
    GetPageReference browser1,pageRef1
    </pre><hr />

    StartBrowser starts an IE browser with createObject("InternetExplorer.Application").

    So, I'm having two IE sessions and I want to return a reference for Browser("title:="&amp;title,"hwnd:="&amp;hwnd).Pag e("title:="&amp;title).
    for every session of the browser.
    But my script hangs and throws an error like "Cannot reference the parent object Browser" when it reaches title = Browser("hwnd:="&amp;hwnd).GetROProperty("title") in GetPageReference.

    Can somebody give me a hint why?

    Best Regards
    Best regards

  2. #2
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Browser object issue in programmatic description

    First of all why you want to use 2 properties? title and hwnd. Since you are getting the hwnd at run-time, you can use just the hwnd or just the title you get from the hwnd.

    And about the script. Restart the machine and try your code again.

  3. #3
    Junior Member
    Join Date
    Jul 2007
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Browser object issue in programmatic description

    Hy Tarun,

    I'm getting the title property in order to use it in describing the Page. I don't know if it is best practice but it works [img]/images/graemlins/smile.gif[/img]

    I've restarted the machine and the script works ... ????!!!! [img]/images/graemlins/smile.gif[/img] Thanks ... is this a glitch in QTP?

    Best regards
    Best regards

  4. #4
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Browser object issue in programmatic description

    nope. using CreateObject("internetexplorer.application") does not give fresh ie window. So when you tried recognizing the Browser window using hwnd which is fool proof method and it didnt work, meant the IE created using createobject was one launched before QTP. So it cannot be recognized as a Browser but a window. Restarting the machine restarts the IE COM server. So you get a fresh IE, atleast for the first time you run the code.

  5. #5
    Junior Member
    Join Date
    Jul 2007
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Browser object issue in programmatic description

    Thanks Tarun! [img]/images/graemlins/smile.gif[/img]
    Best regards

 

 

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 12.50%
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 05:34 AM.

Copyright BetaSoft Inc.