RESOLVED FIXED 174499
Web Automation: link and partial link queries don't work if text link contains trailing or leading whitespaces
https://bugs.webkit.org/show_bug.cgi?id=174499
Summary Web Automation: link and partial link queries don't work if text link contain...
Carlos Garcia Campos
Reported 2017-07-14 03:14:14 PDT
This is causing test test_Driver_Can_Get_Link_By_Link_Test_Ignoring_Trailing_Whitespace to fail. The selenium atoms don't use xpath for links, they use css query to get all links and then they compare with the *visible* text. I think we can keep using xpath, though, but using normalize-space() function to compare with the given text. ========================================================================================== FAILURES ========================================================================================== _______________________________________________________ test_Driver_Can_Get_Link_By_Link_Test_Ignoring_Trailing_Whitespace[WebKitGTK] ________________________________________________________ driver = <selenium.webdriver.webkitgtk.webdriver.WebDriver (session="add1a4bd-2753-4b49-96b1-fd9dfa64e6d0")>, pages = <conftest.Pages object at 0x7ff814790490> def test_Driver_Can_Get_Link_By_Link_Test_Ignoring_Trailing_Whitespace(driver, pages): pages.load("simpleTest.html") > link = driver.find_element(By.LINK_TEXT, "link with trailing space") E NoSuchElementException: Message: ../selenium/webdriver/remote/errorhandler.py:193: NoSuchElementException
Attachments
Patch (1.82 KB, patch)
2017-07-14 03:18 PDT, Carlos Garcia Campos
no flags
Rebased patch (1.82 KB, patch)
2017-07-17 00:05 PDT, Carlos Garcia Campos
bburg: review+
buildbot: commit-queue-
Archive of layout-test-results from ews116 for mac-elcapitan (1.80 MB, application/zip)
2017-07-17 01:33 PDT, Build Bot
no flags
Carlos Garcia Campos
Comment 1 2017-07-14 03:18:57 PDT
Created attachment 315414 [details] Patch This won't apply because it depends on patch attached to bug #174498. Note also that this still doesn't fix test_Driver_Can_Get_Link_By_Link_Test_Ignoring_Trailing_Whitespace, but now it fails because of our poor implementation of GetText: ========================================================================================== FAILURES ========================================================================================== _______________________________________________________ test_Driver_Can_Get_Link_By_Link_Test_Ignoring_Trailing_Whitespace[WebKitGTK] ________________________________________________________ driver = <selenium.webdriver.webkitgtk.webdriver.WebDriver (session="e5b70972-d8f7-4de9-8324-d6f4e3607345")>, pages = <conftest.Pages object at 0x7f3257a58490> def test_Driver_Can_Get_Link_By_Link_Test_Ignoring_Trailing_Whitespace(driver, pages): pages.load("simpleTest.html") link = driver.find_element(By.LINK_TEXT, "link with trailing space") assert link.get_attribute("id") == "linkWithTrailingSpace" > assert link.text == "link with trailing space" E assert 'link with trailing space ' == 'link with trailing space' E - link with trailing space E ? - E + link with trailing space selenium/webdriver/common/driver_element_finding_tests.py:568: AssertionError
Radar WebKit Bug Importer
Comment 2 2017-07-14 08:29:01 PDT
Carlos Garcia Campos
Comment 3 2017-07-17 00:05:52 PDT
Created attachment 315644 [details] Rebased patch It should apply now
Build Bot
Comment 4 2017-07-17 01:33:32 PDT
Comment on attachment 315644 [details] Rebased patch Attachment 315644 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/4134321 New failing tests: security/contentSecurityPolicy/video-with-data-url-allowed-by-media-src-star.html
Build Bot
Comment 5 2017-07-17 01:33:33 PDT
Created attachment 315648 [details] Archive of layout-test-results from ews116 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Blaze Burg
Comment 6 2017-07-17 10:40:13 PDT
Comment on attachment 315644 [details] Rebased patch r=me I had no idea this function was a thing.
Carlos Garcia Campos
Comment 7 2017-07-17 23:28:37 PDT
(In reply to Brian Burg from comment #6) > Comment on attachment 315644 [details] > Rebased patch > > r=me > > I had no idea this function was a thing. Me neither :-P Note that the spec explicitly says we should apply the visible text algorithm here, but just normalizing spaces will cover mot of the cases I think, anyway.
Carlos Garcia Campos
Comment 8 2017-07-17 23:29:09 PDT
Note You need to log in before you can comment on or make changes to this bug.