Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: a.tagName.toUpperCase is not a function when input id or name is 'tagName' #14229

Closed
yoshitaka-ogata opened this issue Jul 5, 2024 · 7 comments
Labels
help wanted Issues looking for contributions I-defect

Comments

@yoshitaka-ogata
Copy link

yoshitaka-ogata commented Jul 5, 2024

What happened?

node.tagName.toUpperCase() may throw the error because the form tagName returns a child input element instead of the tag name if the input element id or name is 'tagName'.

The error was raised at

(!opt_tagName || node.tagName.toUpperCase() == opt_tagName);

FYI Playwright fixed the same issue. microsoft/playwright#30636

How can we reproduce the issue?

HTML

<form id="aaa">
  <input type="text" name="tagName">
</form>

Python

elm = driver.find_element(by=By.ID, value="aaa")
displayed = elm.is_displayed()

Relevant log output

Traceback (most recent call last):
  File "xxxxxx/selenium/xxxxxx.py", line 20, in <module>
    displayed = elm.is_displayed()
  File "xxxxxx/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 252, in is_displayed
    return self.parent.execute_script(f"/* isDisplayed */return ({isDisplayed_js}).apply(null, arguments);", self)
  File "xxxxxx/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 414, in execute_script
    return self.execute(command, {"script": script, "args": converted_args})["value"]
  File "xxxxxx/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 354, in execute
    self.error_handler.check_response(response)
  File "xxxxxx/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: javascript error: a.tagName.toUpperCase is not a function
  (Session info: chrome=126.0.6478.127)

Operating System

macOS

Selenium version

Python selenium 4.22.0

What are the browser(s) and version(s) where you see this issue?

Chrome 126.0.6478.126.0

What are the browser driver(s) and version(s) where you see this issue?

Chrome driver 126.0.6478.126.0

Are you using Selenium Grid?

No response

Copy link

github-actions bot commented Jul 5, 2024

@yoshitaka-ogata, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@diemol
Copy link
Member

diemol commented Jul 5, 2024

I am not sure if the atom is being used by ChromeDriver. I think they have their own implementation.

However, can you help us with a fix through a PR, and we can give you a nightly build to test it? Adding a test to the PR would be ideal. Thank you!

@diemol diemol added help wanted Issues looking for contributions and removed needs-triaging labels Jul 5, 2024
Copy link

github-actions bot commented Jul 5, 2024

This issue is looking for contributors.

Please comment below or reach out to us through our IRC/Slack/Matrix channels if you are interested.

@yoshitaka-ogata
Copy link
Author

Thank you for your comment.

According to the Chromium project's read me, Chrome Driver clones the Selenium repository and builds it by bazel. Therefore, I think it needs to be fixed to resolve the Chrome Driver error.

I'll prepare a PR later.

@shbenzer
Copy link
Contributor

Can be closed with the above merge

@yoshitaka-ogata
Copy link
Author

@shbenzer Thank you. I'll close this issue and PR.

Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Issues looking for contributions I-defect
Projects
None yet
Development

No branches or pull requests

3 participants