SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Apprentice
    Join Date
    May 2008
    Posts
    28
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Getting General Error while running the script

    Hi

    I have seen the code to maximize the browser in this forum.
    Running the script as it is the script is getting passed
    hwnd = Browser("micClass:=Browser").GetRoProperty("hwnd")
    Window("hwnd:="&hwnd).Maximize

    I added two lines to the script, and when i am trying to execute the script its getting General Error.

    Can u plz tel me how can i go further

    Set IE = CreateObject("InternetExplorer.Application")
    ie.visible =1
    ie.navigate "www.google.com"
    set ie = nothing
    hwnd = Browser("micClass:=Browser").GetRoProperty("hwnd")
    Window("hwnd:="&hwnd).Maximize

    Thanks
    Swarup

  2. #2
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Getting General Error while running the script

    Try this:

    Set IE = CreateObject("InternetExplorer.Application")
    IE.visible =1
    IE.navigate "www.google.com"
    set ie = nothing
    sHwnd = Browser("CreationTime:=0").GetRoProperty("hwnd")
    Window("hwnd:="&sHwnd).Maximize

    Mark Smith.

  3. #3
    Senior Member
    Join Date
    Feb 2008
    Location
    Los Angeles, CA, USA
    Posts
    861
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Getting General Error while running the script

    Make sure the browser you are working on is opened by QTP, and not manually.
    -Suchit

  4. #4
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Getting General Error while running the script

    Systemutil.Run "iexplore.exe","www.google.com",,,"3"

  5. #5
    Senior Member
    Join Date
    Feb 2001
    Location
    USA
    Posts
    776
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Getting General Error while running the script

    [ QUOTE ]
    Make sure the browser you are working on is opened by QTP, and not manually.

    [/ QUOTE ]

    This is not true.
    Try this.

    1)Open QTP
    2)Open IE manually
    3)Run below code from QTP
    msgbox Browser("CreationTime:=0").GetRoProperty("hwnd")
    Thanks,
    Prashant Patel

  6. #6
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Getting General Error while running the script

    [ QUOTE ]
    Hi

    I have seen the code to maximize the browser in this forum.
    Running the script as it is the script is getting passed
    hwnd = Browser("micClass:=Browser").GetRoProperty("hwnd")
    Window("hwnd:="&hwnd).Maximize

    I added two lines to the script, and when i am trying to execute the script its getting General Error.

    Can u plz tel me how can i go further

    Set IE = CreateObject("InternetExplorer.Application")
    ie.visible =1
    ie.navigate "www.google.com"
    set ie = nothing
    hwnd = Browser("micClass:=Browser").GetRoProperty("hwnd")
    Window("hwnd:="&hwnd).Maximize

    Thanks
    Swarup

    [/ QUOTE ]
    I think you don't have synchronozation here for navigate which is causing general run error.
    1)
    <font class="small">Code:</font><hr /><pre>Set IE = CreateObject("InternetExplorer.Application")
    IE.visible =1
    IE.navigate "www.hp.com"
    Do While IE.Busy
    Wait(1)
    Loop
    set IE = nothing
    sHwnd = Browser("CreationTime:=0").GetRoProperty("hwnd")
    Window("hwnd:="&amp;sHwnd).Maximize</pre><hr />

    2) Use QTP power, all with one line
    <font class="small">Code:</font><hr /><pre> Systemutil.Run "iexplore.exe","www.google.com",,,"3" </pre><hr />

  7. #7
    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: Getting General Error while running the script


    Set IE = CreateObject("InternetExplorer.Application")
    ie.visible =1
    ie.navigate "www.google.com"
    hwnd = ie.hWnd
    set ie = nothing
    'hwnd = Browser("micClass:=Browser").GetRoProperty("hwnd")
    Window("hwnd:=" &amp; hwnd).Maximize

  8. #8
    Senior Member
    Join Date
    Feb 2008
    Location
    Los Angeles, CA, USA
    Posts
    861
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Getting General Error while running the script

    [ QUOTE ]
    [ QUOTE ]
    Make sure the browser you are working on is opened by QTP, and not manually.

    [/ QUOTE ]

    This is not true.
    Try this.

    1)Open QTP
    2)Open IE manually
    3)Run below code from QTP
    msgbox Browser("CreationTime:=0").GetRoProperty("hwnd")

    [/ QUOTE ]

    If you are using 9.5, some of the methods won't work if you have browser opened manually. Also, if you have the browser opened before you open QTP application, many methods won't work. So just to be safe, I prefer opening the Browser by a QTP statement
    -Suchit

 

 

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 10.71%
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 01:45 AM.

Copyright BetaSoft Inc.