WebDriver: locator strategy should be validated before trying to find elements
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Nov 2017 13:48:46 +0000 (13:48 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Nov 2017 13:48:46 +0000 (13:48 +0000)
commitd1aa04a40819c2abaf04c710d6ede1b14ef8e3d2
tree7c9d9be38d5ed5b00b0c7bea5c3b83fcfe935019
parent57489eaf8c9c96c2122ecbca114417bf7177e28d
WebDriver: locator strategy should be validated before trying to find elements
https://bugs.webkit.org/show_bug.cgi?id=180187

Reviewed by Carlos Alberto Lopez Perez.

We currently rely on the js atom to raise an exception in case the locator strategy is not valid, but in case of
find element from element, if the element doesn't exist we fail with stale element error instead of invalid
argument as expected. So, let's validate the strategies when parsing them, which would also avoid going to the
browser in cae of invalid strategy.

Fixes: imported/w3c/webdriver/tests/retrieval/find_element_from_element.py::test_invalid_using_argument[a]

* WebDriverService.cpp:
(WebDriver::isValidStrategy):
(WebDriver::findStrategyAndSelectorOrCompleteWithError):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebDriver/ChangeLog
Source/WebDriver/WebDriverService.cpp