SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Member
    Join Date
    Feb 2010
    Posts
    178
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Checkbox - WebElement - Editbox

    I have 100 checkboxes on the web page and beside every check box there is one web element and beside web element there are one or two edit boxes.

    It looks like below...
    CHECKBOX1 WEBELEMENTNAME1 EDITBOX1 EDIITBOX1
    CHECKBOX2 WEBELEMENTNAME2 EDITBOX2 EDIITBOX2

    everything here is individual except checkbox and editbox index. I need to use the descriptive programming.

    If want to click on the checkbox and fill the editboxes,
    Is there any way to depend on completely Webelement names.
    i.e If webelement name is XYZ - the click on checkbox and fill the editboxes with some data.

  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: Checkbox - WebElement - Editbox

    Are they all inside a WebTable?

  3. #3
    Member
    Join Date
    Feb 2010
    Posts
    178
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Checkbox - WebElement - Editbox

    Yes. All are the webelements in the WebTable.

  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: Checkbox - WebElement - Editbox

    Then you need to look at the below methods in QTP help file

    GetRowWithCellText
    ChildItem
    ChildItemCount

  5. #5
    Member
    Join Date
    Feb 2010
    Posts
    178
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Checkbox - WebElement - Editbox

    GetRowwithCellText gives me the row number of the particular string. I am not sure, how to proceed with that to solve the above one.

    Moreover, how do I get the WebTable name ?

    Set objTable = Browser("").Page("").WebTable("MyTable")
    intRow = objTable.GetRowWithCellText("MyString")

  6. #6
    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: Checkbox - WebElement - Editbox

    The look at the ChildItem method which takes the row# and col#. Col# you would know based on which object you want to work on and then TEstObject class also you would know.

    I can give you the code but you would rather be benefited by exploring yourself

  7. #7
    Member
    Join Date
    Feb 2010
    Posts
    178
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Checkbox - WebElement - Editbox

    Tarun,

    below is the code that I have come up with.

    set table = Browser("").Page("").WebTable("")
    rows = table.RowCount

    ' Returns the Row Number
    rowid = table.GetRowWithCellText(p2)

    ' Each row returns the column count
    colcnt = table.Columncount(k)

    ' Call the function to set the data for Checkbox, EditBox,
    WebList
    call fDataFill(p1,p3,p4,colcnt,rowid)

    ' Returns the Row Number
    rowid = table.GetRowWithCellText(p6)

    ' Each row returns the column count
    colcnt = table.Columncount(k)

    ' Call the function to set the data for Checkbox, EditBox,
    WebList
    call fDataFill(p5,p7,p8,colcnt,rowid)




    Function fDataFill(m1,m2,m3,colcount,rowno)
    For j = 1 to colcount
    If (table.ChildItem(rowno,j,"WebCheckBox",0) >= 1
    table.WebCheckBox("index:="?).Set m1

    else if (table.ChildItem(rowno,j,"WebEdit",0) >= 1
    table.WebEdit("index:="?).Set m2

    else if (table.ChildItem(rowno,j,"WebList",0) >= 1
    table.WebList("index:="?).Select m3
    End If
    End If
    End If
    Next
    End Function


    But how I should take care of the Index numbers ?

  8. #8
    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: Checkbox - WebElement - Editbox

    Well it seems you are not taking look into the QTP help file

    col = 1
    table.ChildItem(rowno, col, "WebEdit",0).Set "This is test"

    col = 2
    table.ChildItem(rowno, col, "WebCheckBox",0).Set "ON"

  9. #9
    Member
    Join Date
    Feb 2010
    Posts
    178
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Checkbox - WebElement - Editbox

    Thank You, Tarun.
    With the help file only, I could get the above Child Item code.

    But I was thinking, I can check the check boxes or edit box in the normal way (index). As per your two lines above, ChildItem returns True or False.Now do I need to capture that also.

  10. #10
    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: Checkbox - WebElement - Editbox

    ChildItem doesn't return True/false but it returns that TestObject and if it doesn't find anything then it returns Nothing

 

 
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 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 02:10 PM.

Copyright BetaSoft Inc.