I am writing a test case using Selenium PHP Webdriver. What i am trying to do is to test if an element exists on the page or not.
I have found multiple solutions for this case, but unfortunately non of them seem to work as expected (With PHP).
$element = \WebDriverBy::cssSelector("#not_exists tr > td:first-child");
$found = $webDriver->findElements($element);
Running this snippet throws a WebDriverCurlException
instead of NoSuchElementException
as one would expect.
If you read the documentation you will see that in case no elements where found, it should return an empty array which is fine since i could count()
the results. but this is not the case.
I could wrap this code inside try - catch
block, but it feels like i am missing something here.