Imagine having a table structured like this
<h2>HTML Table</h2>
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Code</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>THK-ASA-AKK</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>KAL-ASA-AKK</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td>MAK-ASA-AAKS</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>ABC-ASA-AKK</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>BSA-ASA-AKK</td>
</tr>
<tr>
<td>Ernst Alimentari Riuniti</td>
<td>Giovanni Rovelli</td>
<td>KAL-ASA-AKK</td>
</tr>
</table>
To locate the values under the Code header for Ernst, specifically two of them, using Protractor, you can implement the following method.
An attempt to achieve this goal by selecting the element with the code provided below:
element.all(by.cssContainingText('td','Ernst')).elment(by.css('td:nth-child(3)')).getText().then(function(code){
console.log(code)});
Despite running the script successfully, the desired text is not being displayed. What could be done differently to accomplish this task?