SPONSORS:






User Tag List

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

    Get cell data from a table

    Hi all - I am using selenium (with FF browser) integrated with VSTS 2010.

    I am trying to extract a data from a cell (table) in the web page. But I am having hard time getting the expected data out from the UI. Please find the image of the table that I am working with.

    Here is the xpath for the cell data...
    .//*[@id='FeaturesTable-table-container']/div/div/table/tbody/tr[3]/td[3] - From firepath
    id('FeaturesTable-table-container')/x:div/x:div/x:table/x:tbody/x:tr[3]/x:td[3]
    - From Xpath
    Attached Images Attached Images

  2. #2
    Member
    Join Date
    Jul 2011
    Location
    Bangalore, India
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Get cell data from a table

    Open Selenium IDE and then put this Xpath into it and click Find button. if this highlights the object then it is getting identified.

    Next Step:
    use a for loop - either tr[i] or td[i] should give you the column / row data when it is used along with Selenium.getText()

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

    Re: Get cell data from a table

    You might also want to see if you can rework the XPath to include more class, name, ID or other attribute identifiers beyond the relative node positioning (no node # or like td[3]). In case the layout changes, unless you always know you are looking for specific rows or column #s

  4. #4
    New Member
    Join Date
    Dec 2009
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Get cell data from a table

    1.Start selenium IDE and right click on the text which you want to extract
    2. Select the option assertText which has the Xpath
    3. String var = selenium.getValue(<Xpath&gt
    4. If not the above try String var = selenium.getText(<Xpath&gt

  5. #5
    Member
    Join Date
    Sep 2010
    Location
    TN, India
    Posts
    377
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Get cell data from a table

    Always try to use Relative Path rather than Absolute path. Use IDE to FIND element with different combinations.Hope this link will give you ideas...

    http://seleniumtesters.blogspot.com/...p-or-glob.html

    Thanks...
    Thank/Like to help others if my input helped you !!!
    I am speaking for myself, not for my employer nor any one.
    Automation Ecstasy

  6. #6
    Member
    Join Date
    Sep 2008
    Location
    India
    Posts
    422
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Get cell data from a table

    Hi ,

    you can directly access your table cell contents using getTable , below is the syntax and example.

    syntax:
    String var=sel.getTable("table locator table.row.column");

    example
    String var=sel.getTable(".//*[@id='FeaturesTable-table-container']/div/div/table table.1.2");
    ~Vivek
    -------------------------------------------
    Software Testing Interview Question and Answer
    --------------------------------------------

  7. #7
    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: Get cell data from a table

    What about use webdriver to get cell data?

 

 

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 8.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 06:24 AM.

Copyright BetaSoft Inc.