0

Trying to read the following table.

<div class="well" style="background-color: #fff;">
                <table class="table table-bordered table-striped table-condensed">
                    <tbody><tr>
                        <td style="width: 20%; vertical-align: middle">
                            <span class="label label-primary">Field0</span>
                        </td>
                        <td>Value0</td>
                    </tr>
                    <tr>
                        <td style="width: 120px;">Field1</td>
                        <td>Value1</td>
                    </tr>
                    <tr>
                        <td><strong>Field2</strong></td>
                        <td>Value2</td>
                    </tr>
                  </tbody>
                </table>
    </div>

However, I am stuck when I am trying to get each of the values individually.

     "return $$('.well').get(0).all(by.tagName('td')).get(0).getText();"
Srachakr
  • 35
  • 7
  • Possible duplicate of [Protractor : Read Table contents](https://stackoverflow.com/questions/29501976/protractor-read-table-contents) – Barney Jun 19 '18 at 22:48
  • I tried to follow that but the issue I am facing is, all(by.tagName('td')).get(0).getText(); is not returning anything, instead printing the entire possible list of functions provided by Protractor. – Srachakr Jun 20 '18 at 02:52
  • how do you work with Promises? – Oleksii Jun 20 '18 at 10:47
  • return $('.well').all(by.tagName('td')).then(function(t){ return t[0].getText().then(function(val){ return val; }) }); – Srachakr Jun 20 '18 at 22:01

0 Answers0