WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
174619
WebDriver: handle invalid selector errors
https://bugs.webkit.org/show_bug.cgi?id=174619
Summary
WebDriver: handle invalid selector errors
Carlos Garcia Campos
Reported
2017-07-18 01:56:09 PDT
§12. Element Retrieval. Step 6: If a DOMException, SyntaxError, XPathException, or other error occurs during the execution of the element location strategy, return error invalid selector.
https://www.w3.org/TR/webdriver/#dfn-find
We are currently handling only XPathException and only when it's an invalid expression. In the xpath case, the spec also says "If any item in result is not an element return an error with error code invalid selector.", so we should also handle TYPE_ERR (The expression could not be converted to return the specified type.). However, since the spec says "or other error", I think we can simplify this and simply throw InvalidSelector inside the catch, without checking any specific error. This is causing 14 failures in driver_element_finding_tests.py: selenium/webdriver/common/driver_element_finding_tests.py ........................FF...........F..F.......F..FFFFFFFF..........F.F................. ================================================================================== short test summary info =================================================================================== FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Finding_ASingle_Element_By_Empty_Tag_Name_Should_Throw[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Finding_Multiple_Elements_By_Empty_Tag_Name_Should_Throw[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Finding_Multiple_Elements_By_Empty_Class_Name_Should_Throw[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Finding_Multiple_Elements_By_Invalid_Class_Name_Should_Throw[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Should_Be_Able_To_Find_Element_By_XPath_With_Namespace[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Should_Throw_InvalidSelectorException_When_XPath_Is_Syntactically_Invalid_In_Driver_Find_Element[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Should_Throw_InvalidSelectorException_When_XPath_Is_Syntactically_Invalid_In_Driver_Find_Elements[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Should_Throw_InvalidSelectorException_When_XPath_Is_Syntactically_Invalid_In_Element_Find_Element[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Should_Throw_InvalidSelectorException_When_XPath_Is_Syntactically_Invalid_In_Element_Find_Elements[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Should_Throw_InvalidSelectorException_When_XPath_Returns_Wrong_Type_In_Driver_Find_Element[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Should_Throw_InvalidSelectorException_When_XPath_Returns_Wrong_Type_In_Driver_Find_Elements[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Should_Throw_InvalidSelectorException_When_XPath_Returns_Wrong_Type_In_Element_Find_Element[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Should_Throw_InvalidSelectorException_When_XPath_Returns_Wrong_Type_In_Element_Find_Elements[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Finding_Multiple_Elements_By_Empty_Css_Selector_Should_Throw[WebKitGTK] FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Finding_Multiple_Elements_By_Invalid_Css_Selector_Should_Throw[WebKitGTK] Only one of those is a different issue.
Attachments
Patch
(7.23 KB, patch)
2017-07-18 02:01 PDT
,
Carlos Garcia Campos
bburg
: review+
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews125 for ios-simulator-wk2
(997.04 KB, application/zip)
2017-07-18 03:28 PDT
,
Build Bot
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Carlos Garcia Campos
Comment 1
2017-07-18 02:01:36 PDT
Created
attachment 315782
[details]
Patch selenium/webdriver/common/driver_element_finding_tests.py ................................................F........................................ ================================================================================== short test summary info =================================================================================== FAIL selenium/webdriver/common/driver_element_finding_tests.py::test_Should_Be_Able_To_Find_Element_By_XPath_With_Namespace[WebKitGTK]
Carlos Garcia Campos
Comment 2
2017-07-18 02:05:51 PDT
(In reply to Carlos Garcia Campos from
comment #1
)
> Created
attachment 315782
[details]
> Patch > > selenium/webdriver/common/driver_element_finding_tests.py > ................................................F............................ > ............ > ============================================================================= > ===== short test summary info > ============================================================================= > ====== > FAIL > selenium/webdriver/common/driver_element_finding_tests.py:: > test_Should_Be_Able_To_Find_Element_By_XPath_With_Namespace[WebKitGTK]
btw, this test is marked xfail in all the drivers, so I'll do the same marking it as raising invalid selector.
Build Bot
Comment 3
2017-07-18 03:28:07 PDT
Comment on
attachment 315782
[details]
Patch
Attachment 315782
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
http://webkit-queues.webkit.org/results/4140770
New failing tests: imported/w3c/IndexedDB-private-browsing/idbfactory_open12.html
Build Bot
Comment 4
2017-07-18 03:28:08 PDT
Created
attachment 315788
[details]
Archive of layout-test-results from ews125 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews125 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.5
Blaze Burg
Comment 5
2017-07-18 15:26:56 PDT
Comment on
attachment 315782
[details]
Patch r=me
Radar WebKit Bug Importer
Comment 6
2017-07-18 15:27:19 PDT
<
rdar://problem/33387681
>
Carlos Garcia Campos
Comment 7
2017-07-18 23:12:00 PDT
Committed
r219652
: <
http://trac.webkit.org/changeset/219652
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug