New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebDriver throws misleading exception for missing element #3528

Closed
cmbuckley opened this Issue Sep 19, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@cmbuckley

cmbuckley commented Sep 19, 2016

For the following steps:

$I->amOnUrl("https://www.google.com");
$I->click("Link Text");

The following failure is seen (as expected):

Step  Click "Link Text"
Fail  Link or Button or CSS or XPath element with 'Link Text' was not found.

However this works as expected because Codeception\Util\Locator::isCSS("Link Text") returns true, so the call to $this->match in WebDriver::click is returning an empty list rather than a MalformedLocatorException.

So if the following steps are used instead:

$I->amOnUrl("https://www.google.com");
$I->click("Link 2");

Since "Link 2" does not match the same isCSS check, match throws the exception.

This is equivalent of #2408 for WebDriver, and was not properly fixed by #2960/#2966.

I am aware that $I->click(["link" => "Link 2"]); will work, but this is about fixing the exception message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment