w3c / w3c/webdriver

Only accept valid tag names in Find element with "tag name" strategy?

Open
#1,685 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Find Element Find Element From Element Find Elements Find Elements From Element needs-discussion
Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

This question comes from the following geckodriver issue: https://github.com/mozilla/geckodriver/issues/2007

Chrome/chromedriver currently throws if Find Element by "tag name" is used with an empty string as the tag name, whereas Firefox/geckodriver will not throw and return an empty list.

At the moment, nothing in the specification mentions that the tag name should be validated before being used for get elements by tag name (https://www.w3.org/TR/webdriver/#tag-name). And getElementsByTagName does not throw when used with an empty string.

But selenium atoms prevent from using Find Element with an empty string as tag name. Chromedriver relies directly on selenium atoms to implement Find Element, so right now it throws with : invalid selector: Unable to locate an element with the tagName "".

The question is whether we should update the spec to align to the current behavior of selenium atoms & chromedriver and start validating the tag names, or rather update atoms to fit the current spec (assuming we are understanding it correctly).

I think there are other "invalid" tag names which can be used with getElementsByTagName. Eg ^ is invalid for HTML elements but can still be used with Find Element. Only empty string is validated by atoms/chromedriver.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the WebDriver tag-name section and the linked geckodriver issue, then compare the Selenium atoms implementation and the described ChromeDriver and geckodriver behavior. Done means deciding whether empty or otherwise invalid tag names should be validated and documenting a specification and implementation direction.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
api, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.