SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Member
    Join Date
    Aug 2005
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Problems with repeated webelement in a table

    I have a problem here, the webtable contains elements that are repeated, i want to click on the first instance of the repeated webelement. Eg, the emp with deptcode is the contents of the webtable. I want to click on the first instance of emp zzz with 20 as Dept(ie the 2nd row)

    Emp Dept
    xyz 10
    zzz 20
    xyz 10
    xyz 20
    zzz 10
    zzz 20

    My coding:

    rc = Browser("").Page("").Frame("").WebTable("").RowCou nt
    msgbox rc
    For i = 2 To rc
    cd = Browser("").Page("").Frame("").WebTable("").GetCel lData (i,1)

    If (cd = Emp) Then
    cd1 = Browser("").Page("").Frame("").WebTable("").GetCel lData (i,2)
    If (cd1 = Dept) Then

    Set oObj1=Description.Create()
    oObj1("innertext").Value=Dept
    oObj1("html tag").Value="TD"
    Browser("").Page("").Frame("").WebElement(oObj1).F ireEvent "onclick"

    End If
    End If
    next

    The error i get is "The [webelement] object description matches more than one of the objects currently displayed in ur appln"
    Any sugesstions?

  2. #2
    Senior Member
    Join Date
    Jun 2007
    Location
    IL, US
    Posts
    408
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problems with repeated webelement in a table

    Look for ChildItem method of webtable. It will solve your problem.

    Thanks,
    Pavan

  3. #3
    Member
    Join Date
    Jun 2006
    Location
    NY, US
    Posts
    55
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problems with repeated webelement in a table

    Add Index:= 0 to your object description -
    oObj1("innertext").Value=Dept
    oObj1("html tag").Value="TD"
    oObj1("Index").Value = "0"

    This will pick the first instance of the webelement.

  4. #4
    Member
    Join Date
    Aug 2005
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problems with repeated webelement in a table

    Thank you guys for your quick reply...
    but my problem is still there if the table is like this

    emp dept
    xyz 20
    zzz 20

    and i want to click on the zzz 20, adding the index clicks on the first row.

  5. #5
    Member
    Join Date
    Jun 2006
    Location
    NY, US
    Posts
    55
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problems with repeated webelement in a table

    In that case try this -
    Browser("").Page("").Frame("").WebTable("").WebEle ment(oObj1).FireEvent "onclick"

    Or alternatively -
    get the ChildObject (oObj1) from Browser().Page().Webtable() and use FireEvent "onclick" on it.
    If (cd = Emp) Then
    cd1 = Browser("").Page("").Frame("").WebTable("").GetCel lData (i,2)
    If (cd1 = Dept) Then

    Set oObj1=Description.Create()
    oObj1("innertext").Value=Dept
    oObj1("html tag").Value="TD"
    oObj1("Index").Value = "0"

    Set collElement = Browser("").Page("").Frame("").WebTable("").ChildO bject(oObj1)
    collElement(0).FireEvent "onclick"

  6. #6
    Member
    Join Date
    Aug 2005
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problems with repeated webelement in a table

    I am getting a error that
    Object doesn't support this property or method: 'Browser(...).Page(...).Frame(...).WebTable(...).C hildObject'

    at this stmt:
    Set collElement = Browser("").Page("").Frame("").WebTable("").ChildO bject(oObj1)

  7. #7
    Member
    Join Date
    Aug 2005
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problems with repeated webelement in a table

    I am getting a different error now on the last line "General run error" (ie )
    collElement(0).FireEvent "onclick". Any help?


    The previous error was my bad that i used ChildObject instead of ChildObjects.

    I have one more question, how can i see all the childobjects of the web table, msgbox didn;t work.

  8. #8
    Senior Member
    Join Date
    Dec 2006
    Posts
    225
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problems with repeated webelement in a table


    check if collElement is Not Null...that is check for the count of the collection. If its 0 then we will get the error.

    oObj1("innertext").Value=Dept (quotes are missing for Dept)
    Regards,
    Kalesh

  9. #9
    Advanced Member
    Join Date
    Sep 2007
    Location
    Chennai, Tamil nadu, India
    Posts
    999
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problems with repeated webelement in a table

    Try below and post the result.

    <font class="small">Code:</font><hr /><pre>rc = Browser("").Page("").Frame("").WebTable("").RowCou nt

    For i = 2 To rc
    cd = Browser("").Page("").Frame("").WebTable("").GetCel lData (i,1)
    cd1 = Browser("").Page("").Frame("").WebTable("").GetCel lData (i,2)
    If Cd = "zzz" and cd1 = 20 Then
    Browser("").Page("").WebTable("").ChildItem(i,0,"W ebElement",0).click
    Exit For
    End IF
    Next</pre><hr />
    i have never seen bugs sleeping

  10. #10
    Member
    Join Date
    Aug 2005
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problems with repeated webelement in a table

    Thank u so much, i worked...

    The only thing i modified is instead of
    Browser("").Page("").WebTable("").ChildItem(i,0,"W ebElement",0).click
    as the above gave me this run error
    The "" WebTable object was not found in the Object Repository.
    Check the Object Repository to confirm that the object exists or to find the correct name for the object.


    so i wrote

    Browser("").Page("").Frame("").WebTable("").ChildI tem(i,0,"WebElement",0).click

    Thank you again.

 

 
Page 1 of 2 12 LastLast

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 9.38%
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 10:45 PM.

Copyright BetaSoft Inc.