SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Oct 2000
    Location
    Halifax, NS, Canada
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    locating cells in an HTML table

    I have a string that has been previously declared with a certain value, and an HTML table to use (multiple rows and columns). I want to parse through the table (in a specific column), checking the value of each cell in that column to see if it matches with the declared string.

    If the two values are a match, I want to stay in that row and jump over 2 columns to click the HTML link it contains. There will always be the same number of columns in the table, but the number of rows changes often and there's no way to know which row will contain the matching data.

    I understand that SilkTest has some "issues" when dealing with HTML tables, but does anyone have any ideas how I might accomplish this task?

    I've been looking at the Table class but it's not making much sense to me. I'm hoping Santa brings the Segue people some more tech writers for Christmas so they can beef up their documentation... =)



  2. #2
    Senior Member
    Join Date
    Mar 2000
    Location
    Dublin, Ireland
    Posts
    152
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: locating cells in an HTML table

    Hi,

    You need to look at the HTMLColumn class rather than the HTMLTable class.

    Using the GetRowText method for the htmlcolumn you can retrieve the text from each cell. As you are moving through each cell, that is down the column, keep a count of the row number that you are on. When you find the text matching your expected value and since you have the row number of the cell, you can navigate to the second cell in the html table, (as you know both the column no and row no of that second cell).

    I hope that this helps.

    John.
    John O'Neill.
    Quality Automation Ltd.
    www.quality-automation.com

  3. #3
    Junior Member
    Join Date
    Oct 2000
    Location
    Halifax, NS, Canada
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: locating cells in an HTML table

    Thanks for the help John...

    I spent yesterday afternoon working through the problem and I've managed to find a solution that "almost works".

    I'm was able to parse through the text values in a certain column to find a matching string. If a match is found, it stays on the same row and jumps over to a seperate column to match a second string.

    The second column contains HTML links that say either "registered" or "unregistered. If it says registered I want the script to click the link in the row that was being used before.

    I tried using the
    Webpage.tablename.column.linkname.click()
    method, but since there isnt a way to specify which row to perform the action on, it clicks the first instance of the "registered" link in the column (which isnt necessarily the correct row).

    Is there any way to use this method to specify what row of that column to apply the click to?

    Thanks again


  4. #4
    Senior Member
    Join Date
    Mar 2000
    Location
    Dublin, Ireland
    Posts
    152
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: locating cells in an HTML table

    Hi,

    From what I wrote above, you can work out the row number. When you move over to the second column you have a links in each cell which either says 'Registered' or 'Unregistered'. As these are links embedded in a html table, you can use a syntax similiar to this to click on the link:

    MyHtmlTable.MyHtmlColumn.HtmlLink("#{iRowNumber}") .Click ()

    There should not be any need to declare the html links within the column. This line of code has the html link tag embedded in the object identifier. The link is tagged by index. The link's index is related its position within the html column, but its position within the column is just the row that the link is on. So the row number is the same as the link's index.

    Note that this method works independently of the caption of the link. If you only wanted to click on 'Registered' links then I suggest that you check the link caption before clicking on it.

    MyHtmlTable.MyHtmlColumn.HtmlLink("#{iRowNumber}") .GetCaption ()

    Regards,

    John.
    John O'Neill.
    Quality Automation Ltd.
    www.quality-automation.com

  5. #5
    Junior Member
    Join Date
    Oct 2000
    Location
    Halifax, NS, Canada
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: locating cells in an HTML table

    The HtmlLink("#{iRowNumber}") method worked perfectly since I had already determined which row the information was found on.

    Thanks for the help.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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:37 AM.

Copyright BetaSoft Inc.