I want to test a list of records with codeception. I have a form and have unique rows like this
<tr id="row1">
<td class="description">
<input name="description" type="text" value="some text">
</td>
</tr>
<tr id="row2">
<td class="description">
<input name="description" type="text" value="some more text">
</td>
</tr>
so the name of the field is the same while the id of the row is not. When I try to
$I->fillField("#row1 input[name='description']", "some other text");
it fails with
Field by name, label, CSS or XPath '#row1 input[name="description"]' was not found on page.
I believe the answer is just around the corner but I am struggling to find it. Any hints or ideas?
Thanx,
m!
You could use the CSS selectors td:nth-child(1) or td:nth-of-child(1) .
Also beware (IRC) that PHPBrowser only can use fillField on fields contained inside a form.
You can try to use with xpath like:
$I->fillField("//*[@id='row1']//input","Input text here");
In case you really want to play with CSS, you can try with following code:
$I->fillField("#row1 input","Input text here");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.