I am using behat with a zombie driver to test my application. Now I am trying to click on an element (a td), to fire an ajax request. But when clicking this element I receive the error:
Error while processing event 'click' (Behat\Mink\Exception\DriverException
The code I use is from this thread
Nowhere on the internet I can find someone with the same error message, so I have no clue how to solve this.
The HTML I want to click on looks like this:
<td value="2" onclick="switchStatus(this.id); updateScores();; return false;" id="37_12_2">2</td>
These javascript functions do an ajax call to the server and do nothing with the saved result (no success method).
The test function I use looks like this:
/**
* @Given /^I click td "([^"]*)"$/
*/
public function iClickTd($id)
{
$locator = "#$id";
$element = $this->getSession()->getPage()->find('css', $locator);
if (null === $element) {
throw new \InvalidArgumentException(sprintf('Could not evaluate CSS selector: "%s"', $locator));
}
$element->click();
$this->getSession()->wait(1000);
}
And in the test I have:
And I click td "37_12_2"
The behat.yml:
default:
suites:
default:
contexts:
- FeatureContext:
- http://localhost/
extensions:
Behat\MinkExtension\ServiceContainer\MinkExtension:
base_url: http://localhost/
sessions:
default:
goutte: ~
javascript:
zombie:
node_modules_path: '/usr/lib/node_modules/'
Used versions:
- "phpunit/phpunit": "4.5.*",
- "phpspec/phpspec": "~2.1",
- "behat/behat": "~3.0",
- "behat/mink": "~1.6",
- "behat/mink-extension": "~2.0",
- "behat/mink-goutte-driver": "*",
- "behat/mink-zombie-driver": "~1.2"
- npm v1.4.28
- php 5.6
Does anyone know what goes wrong, and how I can make this function work?