SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Jun 2006
    Location
    Chennai
    Posts
    58
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Verify object is in the visible part of web page

    Hi

    I am wondering how to verify if an WebElement is in the visible part of the webpage using QTP.

    Would like to validate if the Web Browser is scrolled to the specific location in the webpage

    My Requirement :

    1. Click on the FAQ Link in the top of the Page.
    2. The Page is navigated and scrolled to the bottow where it contains the answers.
    3. Need to verify if the browser has been navigated correctly to the clicked link above.

    If anyone else had experienced anything similar Please share? ...





    Thanks & Regards
    Ur Friend
    ----------------------------------
    "Quality is not an act, it is a habit."

  2. #2
    Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    374
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Verify object is in the visible part of web page

    hi friend,

    I think "visible" property will not work for this type of issue because even if that webelement (text) is somewhere on the page (upside or downside) you will not able to view it, but QTP says it is VISIBLE...

    1. you can write DP for clicking particular link.
    2. It will automatically scroll after clicking, no need to code.
    3. Need to compare some text which is related to the clicked link.
    - Manish

  3. #3
    Senior Member
    Join Date
    Sep 2006
    Location
    CA, USA
    Posts
    425
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Verify object is in the visible part of web page

    In this case you only need to verify the UI control's property "abs_y"

    Browser.Page.Link.GetROProperty("abs_y")

  4. #4
    Member
    Join Date
    Jun 2006
    Location
    Chennai
    Posts
    58
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Verify object is in the visible part of web page

    Thanks guys for all your suggestions.

    I tried working around and found a solution. I am not sure if this is the perfect solution, Plz suggest.

    <font class="small">Code:</font><hr /><pre> <font color="green">
    'Clicking the link in the top of the page </font>

    Set obj = Browser.Page.Link.Click

    <font color="green">
    'Returns the Height of the viewable area of the page </font>
    intPageViewableAreaSize = Browser.Page.object.body.clientHeight

    <font color="green">
    'Return "Y" axis coordinate value </font>

    intY = Browser.Page.WebElement.GetRoproperty("y")

    <font color="green">
    'Compare and get the result </font>

    If intY &gt; 0 and intY &lt; intPageViewableAreaSize Then
    Msgbox "Web Element is in viewable webpage area"
    Else
    Msgbox "Web Element is not in viewable webpage area"
    End If
    </pre><hr />
    Thanks & Regards
    Ur Friend
    ----------------------------------
    "Quality is not an act, it is a habit."

  5. #5
    Advanced Member
    Join Date
    Aug 2006
    Location
    Other side of the Computer
    Posts
    598
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Verify object is in the visible part of web page

    This is how you call it.
    intResult = fIsVisible(objToCheck)

    This is what you need.

    <font class="small">Code:</font><hr /><pre>
    Function fIsVisible(objElement)
    Dim x, y, intWidth, intHeight

    If IsObject(objElement) Then 'Check to see if the element is object or not.
    x = objElement.GetROProperty("x") 'Get the x value
    y = objElement.GetROProperty("y") 'Get the y value
    intWidth = objElement.GetROProperty("width") 'Get the width value
    intHeight = objElement.GetROProperty("height") 'Get the height value

    If x=0 And y=0 And intWidth=0 And intHeight=0 Then 'Check to see if they are 0's
    fIsVisible = False 'return False if Hidden
    Else
    fIsVisible = True 'Return true if visible.
    End if
    End If
    End Function
    </pre><hr />

    oophs same solution as above.
    ===========================================

 

 

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.00%
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 12:21 PM.

Copyright BetaSoft Inc.