I'm working with Selenium and behat mink for the first time. I have the following code:
$category_dropdown = $this->find('xpath', "//select[@name=\"category\"]");
echo $category_dropdown->getHtml();
$category->selectOptionByText('Take Out);
and the output is:
<option value="183">Fast Food</option>
<option value="186">Take Out</option>
PHP Fatal error: Call to undefined method Behat\Mink\Element\NodeElement::selectOptionByText()
The line $category->selectOptionByText('Take Out');
causes errors because the function selectOptionByText doesn't actually exist. Is there another way to achieve the intended behaviour?
I'm so new to all this that I'm still trying to figure out the online documentation for this framework.
You were close... Try to use
$category->selectOption('Take Out');
Here is the LINK to all the methods from NodeElement class
And by the way there is already Gherkin method which can help you
I select "([^"]|\"*)" from "([^"]|\"*)"
which in your case is
I select "Take Out" from "category"
Here is the LIST of already available Gherkin methods