# How To Read Values Web-Table Row by Row

**URL:** https://forum.robotframework.org/t/how-to-read-values-web-table-row-by-row/5600
**Category:** Robot Framework
**Created:** [25 April 2023 05:19 UTC](https://forum.robotframework.org/t/how-to-read-values-web-table-row-by-row/5600 "2023-04-25T05:19:25Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Gautam](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@Gautam](https://forum.robotframework.org/u/Gautam)
#### Post date: [25 April 2023 05:19 UTC](https://forum.robotframework.org/t/how-to-read-values-web-table-row-by-row/5600/1 "2023-04-25T05:19:25Z")

</div>

Hi Everyone!

Is there a walkaround to get the values/text row by row from a web-table. Below is the sample table html:

| Activity | User | Channel | Date | Time |
| --- | --- | --- | --- | --- |
| " Logs " | User 201 | Internal | Apr 24, 2023 | 08:17 AM |
| " Level 3 Logs " | User 201 | Internal | Apr 23, 2023 | 09:17 PM |

Below is the code that I’ve written so far.

```
${rows} = Get Element Count //table[@id="Session Details"]/tbody/tr[position()>1]

FOR ${row_num} IN RANGE ${rows}
    ${row} = Get WebElement //table[@id="Session Details"]/tbody/tr[position()>1][${row_num}]
    @{cells} = Get WebElements //table[@id="Session Details"]/tbody/tr[position()>1][${row_num}]/td
    ${data} = Create List
    FOR ${cell} IN @{cells}
        Sleep 3s
        Wait Until Element Is Visible ${cell}
        ${text} = Get Element Attribute ${cell} innerText
        ${data} = Evaluate [cell.text for cell in $cells]
        Log ${cell} contains text: ${text}
    END
    Log Row ${row_num} data: ${data}
END

```

Robot Framework Version - 3.1.2  
Robot Framework Selenium Library Version - 3.3.1

The error that I’m getting is: No Keyword with name FOR found.

I even tried with old way of using for loop i.e. : For but got the same error as above  
Can anyone guide me where I’m making mistake in my code?

---

<div class="post-metadata">

### Author: ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)
#### Post date: [25 April 2023 09:27 UTC](https://forum.robotframework.org/t/how-to-read-values-web-table-row-by-row/5600/2 "2023-04-25T09:27:43Z")

</div>

Hi @Gautam,

> [@Gautam](#):
>
> Robot Framework Version - 3.1.2

FOR is part of the Robot Framework syntax since Version 3.1, so not sure why it’s not working in 3.1.2. As that is a very old version of Robot Framework (current version is 6.0.2), your best option is probably to try a more recent version as the issue has probably already been fixed.

Dave.

---

<div class="post-metadata">

### Author: ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)
#### Post date: [25 April 2023 10:51 UTC](https://forum.robotframework.org/t/how-to-read-values-web-table-row-by-row/5600/3 "2023-04-25T10:51:06Z")

</div>

I did try to reproduce your problem but with modern RF and SeleniumLibrary. This is a modified copy of your test, which passes in RF 6.0.2 and SeleniumLibrary 6.0.0:

```plaintext
***Settings***
Library SeleniumLibrary
Library OperatingSystem

***Test Cases***
Test Loop
    [Setup] Prepare Page
    ${rows}= Get Element Count //table[@id="Session Details"]/tbody/tr # //table[@id="Session Details"]/tbody/tr[position()>1]
    FOR ${row_num} IN RANGE 1 ${rows+1}
        # ${row}= \ \ \ Get WebElement \ \ \ //table[@id="Session Details"]/tbody/tr[${row_num}]
        @{cells}= Get WebElements //table[@id="Session Details"]/tbody/tr[${row_num}]
        ${data}= Create List
        FOR ${cell} IN @{cells}
            Sleep 3s
            Wait Until Element Is Visible ${cell}
            ${text}= Get Element Attribute ${cell} innerText
            ${data}= Evaluate [cell.text for cell in $cells]
            Log ${cell} contains text: ${text}
        END
        Log Row ${row_num} data: ${data}
    END
    [Teardown] Cleanup Test

***Keywords***
Prepare Page
    ${content}= Set Variable <table id="Session Details">\n \ \ \ <thead>\n \ \ \ \ \ \ \ <tr>\n \ \ \ \ \ \ \ \ \ \ \ <th> Activity </th>\n \ \ \ \ \ \ \ \ \ \ \ <th> User </th>\n \ \ \ \ \ \ \ \ \ \ \ <th> Channel </th>\n \ \ \ \ \ \ \ \ \ \ \ <th> Date </th>\n \ \ \ \ \ \ \ \ \ \ \ <th> Time </th>\n \ \ \ \ \ \ \ </tr>\n \ \ \ </thead>\n \ \ \ <tbody>\n \ \ \ \ \ \ \ <tr>\n \ \ \ \ \ \ \ \ \ \ \ <td>\n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ " Logs "\n \ \ \ \ \ \ \ \ \ \ \ </td>\n \ \ \ \ \ \ \ \ \ \ \ <td>\n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ <a> User 201 </a>\n \ \ \ \ \ \ \ \ \ \ \ </td>\n \ \ \ \ \ \ \ \ \ \ \ <td> Internal </td>\n \ \ \ \ \ \ \ \ \ \ \ <td> Apr 24, 2023 </td>\n \ \ \ \ \ \ \ \ \ \ \ <td> 08:17 AM </td>\n \ \ \ \ \ \ \ </tr>\n \ \ \ \ \ \ \ <tr>\n \ \ \ \ \ \ \ \ \ \ \ <td>\n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ " Level 3 Logs "\n \ \ \ \ \ \ \ \ \ \ \ </td>\n \ \ \ \ \ \ \ \ \ \ \ <td>\n \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ <a> User 201 </a>\n \ \ \ \ \ \ \ \ \ \ \ </td>\n \ \ \ \ \ \ \ \ \ \ \ <td> Internal </td>\n \ \ \ \ \ \ \ \ \ \ \ <td> Apr 23, 2023 </td>\n \ \ \ \ \ \ \ \ \ \ \ <td> 09:17 PM </td>\n \ \ \ \ \ \ \ </tr>\n \ \ \ </tbody>\n</table>
    Set Test Variable \${FILE} .${TEST_NAME}_experiment.html
    Create File ${FILE}
    Append To File ${FILE} <html>\n \ \ \ <title>Example</title>\n \ \ \ <body>${content}</body>\n</html>
    Open Browser file:///${CURDIR}${/}${FILE} Firefox

Cleanup Test
    Remove File ${CURDIR}${/}${FILE}
    Close All Browsers

```

---

<div class="post-metadata">

### Author: ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)
#### Post date: [25 April 2023 11:06 UTC](https://forum.robotframework.org/t/how-to-read-values-web-table-row-by-row/5600/4 "2023-04-25T11:06:57Z")

</div>

With the same test file, and RF 3.2.1, I get the error at step ` Wait Until Element Is Visible` :

```plaintext
Variable '${cell}' not found. Did you mean: 
   ${cells}

```

It ignored completely the inner FOR.

Like others said, RF 3.1.2 (and 3.2.1) don’t allow nested FOR loops.

---

<div class="post-metadata">

### Author: ![Gautam](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@Gautam](https://forum.robotframework.org/u/Gautam)
#### Post date: [25 April 2023 12:17 UTC](https://forum.robotframework.org/t/how-to-read-values-web-table-row-by-row/5600/5 "2023-04-25T12:17:47Z")

</div>

Thanks for your time and for your guidance @damies13

---

<div class="post-metadata">

### Author: ![Gautam](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@Gautam](https://forum.robotframework.org/u/Gautam)
#### Post date: [25 April 2023 12:19 UTC](https://forum.robotframework.org/t/how-to-read-values-web-table-row-by-row/5600/6 "2023-04-25T12:19:27Z")

</div>

Thanks for your time and for your guidance @HelioGuilherme66
