I apologize in advance but I am very beginner. I try to check checkbox without id or name.
<span class="ps-align-left">
<input type="checkbox" value="43899" style="background-color: rgb(252, 252, 252);"/>
43899
</span>
I figure out how to do it with selenium2driver. So I use function "find" like this:
public function checkOption()
{
$this->getSession()->getPage()->find('css', '.ps-align-left>input')->check();
}
And it works fine but when I try to run test with headless browser Goutte I get error:
/usr/bin/php5.6 /tmp/ide-behat.php --format PhpStormBehatFormatter /home/grzegorz/PhpstormProjects/Test/features/scenariusze.feature
Testing started at 14:48 ...
Malformed field path ""
Can anyone knows the reason? Should I use a different function?
Try to use click and also add Exception in case that the element is not found.
Example: If the element is not found, the find method will return null and you will try to click on null, this will throw a fatal exception and your suite will stop.
if you add an exception only the current scenario will fail and the suite will continue to execute.
If the element is type checkbox and you want to do a check, no matter if is checked or not, you can create a method that uses check() instead of click()