SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Dec 2006
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Selecting a random data in WebTable or WebElement

    Hi All,

    How to select an random data from a search tabel. For ex:- if a user is searching a name with string as 's' and clicks on search. Now, result of 12 is displayed in a search table. Now, how to select the data randomly. The object we can use is WebTable or WebElement. Know we should use "randomize", but how to use that in WebTable or WebElement?. Please provide me with an example.


    Karthik

  2. #2
    Senior Member
    Join Date
    Oct 2006
    Location
    Chennai, India
    Posts
    156
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Selecting a random data in WebTable or WebElement

    Hi,

    try it yourself first and post.. show us your code that you have tried.

    tip: search for getcelldata & randomize in forum and try urself..

    There are plenty of posts for the same.. If you face any issue then.. ask for help.. Just a suggestion.. i too working in QTP in the same way..
    Thanks
    Thiru

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

    Re: Selecting a random data in WebTable or WebElement

    Thiru,

    My script is like this,

    rCount = Browser(....).Page(....).WebTable("Last Name").RowCount
    and
    rCount = Browser(....).Page(....).WebTable("Last Name").Select "#" & Int((cnt * Rnd) + 1)

    but webtable does not support the select. So, struck here


    Karthik

  4. #4
    Senior Member
    Join Date
    Oct 2006
    Location
    Chennai, India
    Posts
    156
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Selecting a random data in WebTable or WebElement

    use like this..

    rowcount=Browser("").Page("").WebTable("").RowCoun t
    colcount=Browser("").Page("").WebTable("").ColumnC ount(1)
    Randomize
    msgbox Browser("").Page("").WebTable("").GetCellData(Int( (rowcount * Rnd) + 1),Int((colcount * Rnd) + 1))
    Thanks
    Thiru

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

    Re: Selecting a random data in WebTable or WebElement

    I have used the scripts & its workking fine, but i need the first column of each row to be selected. Because, only first column has the link. See the attachment.

    In the attachment1 have typed d in the last name & result for its been displayed in a webtable. Now i have to select any one of the Last Name to go to next step. Need help in automating this process.
    Attached Images Attached Images

  6. #6
    Senior Member
    Join Date
    Oct 2006
    Location
    Chennai, India
    Posts
    156
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Selecting a random data in WebTable or WebElement

    Hi Karthik,

    Dont expect someone to give ur solution always.. We would give u a tip that how should u proceed..

    I think you are new into QTP.. First go thorugh the whole tutorial & help..

    BTW,

    code:
    ---------------------------------
    rowcount=Browser("").Page("").WebTable("").RowCoun t
    Randomize
    Browser("").Page("").WebTable("").ChildItem(Int((r owcount * Rnd) + 1),1,"Link",0).object.click
    Thanks
    Thiru

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

    Re: Selecting a random data in WebTable or WebElement

    thanks a lot thiru. I will definitely improve with all your guidance.


    Karthik

 

 

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 11.11%
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:46 AM.

Copyright BetaSoft Inc.