Chromedriver - can't find elements by name when they contain special characters with w3c enabled

117 views
Skip to first unread message

dan p

unread,
Jul 11, 2019, 6:34:31 AM7/11/19
to Selenium Users
Hi,
I've recently updated our CI with version 75.0.3770.90 of chrome/chromedriver.  
Our UI tests use Selenium's Java bindings (v3.141.59) connecting chrome via RemoteWebDriver.

The switch to a w3c enabled chromedriver has exposed an incompatibility between selenium and chromedriver in that we're unable to find elements by "name" with name values that contain special characters.  

For example:
A POST to /session/{session id}/element to locate an element by name with a value of "fields['companyName']" has the following body. 
{    
    "using": "css selector",    
    "value": "*[name='fields['companyName']']"
}
...responds with a 400 - invalid selector: An invalid or illegal selector was specified...

Whereas escaping name characters successfully finds the element:
{    
    "using": "css selector",    
    "value": "*[name='fields\\[\\'companyName\\'\\]']"
}

If I set the w3c chrome option to false, the request body values do not need to be escaped.  The same POST to /session/{session id}/element has the following body:

    "using": "name",
    "value": "fields['companyName']"

...and succeeds (without escaping special characters).

Will the selenium bindings be updated to escape characters in the request body to bring selenium in line with the chromedriver api?  

I couldn't find this listed as a bug against chromedriver or selenium.  I've cross posted this issue in chromedriver-users https://groups.google.com/forum/#!topic/chromedriver-users/GZH7mFLk3O4

Steven Wruk

unread,
Jul 16, 2019, 2:17:02 PM7/16/19
to Selenium Users
Hello,

I'm facing the same problem here.

Is there a related issue on github to this problem?
Reply all
Reply to author
Forward
0 new messages