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]: selenium.common.exceptions.JavascriptException: Message: javascript error: Object.hasOwn is not a function #12078

Closed
qingfeng520 opened this issue May 22, 2023 · 23 comments
Labels
G-chromedriver Requires fixes in ChromeDriver I-defect

Comments

@qingfeng520
Copy link

What happened?

when run the code the code where report a bug:
driver.find_elements(By.XPATH, '//*[@id="app-content"]/div/div[3]/div/div/button')

How can we reproduce the issue?

when run the code: driver.find_elements where report a bug

Relevant log output

File "D:\Softwares\Python3\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 861, in find_elements
    return self.execute(Command.FIND_ELEMENTS, {"using": by, "value": value})["value"] or []
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Softwares\Python3\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "D:\Softwares\Python3\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: javascript error: Object.hasOwn is not a function
  (Session info: chrome=113.0.5672.127)

Operating System

Windows11

Selenium version

Python 3.11.2

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

Chrome 113.0.5672.127

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

ChromeDriver 113.0.5672.63

Are you using Selenium Grid?

No response

@github-actions
Copy link

@qingfeng520, 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 diemol added I-issue-template Applied to issues not following the template, or missing information. and removed needs-triaging labels May 22, 2023
@github-actions
Copy link

Hi, @qingfeng520.
Please follow the issue template, we need more information to reproduce the issue.

Either a complete code snippet and URL/HTML (if more than one file is needed, provide a GitHub repo and instructions to run the code), the specific versions used, or a more detailed description to help us understand the issue.

Note: If you cannot share your code and URL/HTML, any complete code snippet and URL/HTML that reproduces the issue is good enough.

Reply to this issue when all information is provided, thank you.

@diemol
Copy link
Member

diemol commented May 22, 2023

We closed a similar issue last week because there was no way of reproducing it.

@iniyavans
Copy link

iniyavans commented May 24, 2023

@diemol I'm also getting the same issue now

While running the below code

wait.until(EC.presence_of_element_located((By.XPATH, "//button[text()='Get Started']"))).click()

@diemol
Copy link
Member

diemol commented May 24, 2023

@iniyavans can you please provide a complete script to reproduce the issue? Otherwise it will stale and end up being closed.

@iniyavans
Copy link

@diemol will share my repo shortly!

@iniyavans
Copy link

EXTENSION_PATH = os.path.abspath('..') + '/metamask/extension_metamask.crx'

chromeDriver = os.path.abspath('..') + '/metamask/chromedriver/chromedriverV113'

chrome_options = Options()

chrome_options.add_extension(EXTENSION_PATH)

chrome_options.add_experimental_option("detach", True)

chrome_service = Service(chromeDriver)

driver = webdriver.Chrome(options=chrome_options, service=chrome_service)

driver.maximize_window()

driver.get("https://www.google.com/")

wait = WebDriverWait(driver, 20)

wait.until(EC.number_of_windows_to_be(2))

driver.switch_to.window(driver.window_handles[1])

wait.until(EC.presence_of_element_located((By.XPATH, "//button[text()='Get Started']"))).click()

@diemol I used above code

@iniyavans
Copy link

Screenshot 2023-05-24 at 3 20 46 PM
Getting above issue @diemol

@diemol
Copy link
Member

diemol commented May 24, 2023

Two questions:

  • Where do I get this file? EXTENSION_PATH = os.path.abspath('..') + '/metamask/extension_metamask.crx'
  • Does this happen only with that browser extension? What if you use a different one?

@iniyavans
Copy link

iniyavans commented May 24, 2023

@iniyavans
Copy link

iniyavans commented May 24, 2023

Answer for Q2: The basic selenium code will be working fine, I need to add the above extension file to automate my project. @diemol

@diemol
Copy link
Member

diemol commented May 24, 2023

OK, a bit of googling shows me that this is the browser extension
https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn

And if it only happens with that extension, there is not much we can do. Have you reached out to them?

@iniyavans
Copy link

iniyavans commented May 24, 2023

No @diemol We just add the extension during the browser launch, And also the same code worked fine before. The issue comes after updating the Chrome version to 113.

@diemol
Copy link
Member

diemol commented May 24, 2023

I understand, but Selenium is doing its job of launching the browser through ChromeDriver and loading the extension. The code in Selenium has not changed. So you either need to check with the extension maintainers or raise an issue to the ChromeDriver folks.

@iniyavans
Copy link

Okay @diemol, Thanks!

@diemol
Copy link
Member

diemol commented May 25, 2023

I will leave the links where you can report this, but still, I am not sure if this is something with the extension or the browser.

@diemol diemol added G-chromedriver Requires fixes in ChromeDriver and removed I-issue-template Applied to issues not following the template, or missing information. labels May 25, 2023
@github-actions
Copy link

Hi, @qingfeng520.
This issue has been determined to require fixes in ChromeDriver.

You can see if the feature is passing in the Web Platform Tests.

If it is something new, please create an issue with the ChromeDriver team.
Feel free to comment the issues that you raise back in this issue. Thank you.

@disposablecarcass
Copy link

Hi, @qingfeng520. This issue has been determined to require fixes in ChromeDriver.

You can see if the feature is passing in the Web Platform Tests.

If it is something new, please create an issue with the ChromeDriver team. Feel free to comment the issues that you raise back in this issue. Thank you.

Forgive my ignorance, but in that page you listed, how do I actually see if the issue was fixed in Chromedriver?

Does anyone know if this was resolved?

@titusfortner
Copy link
Member

@disposablecarcass looks like a ticket was opened, but couldn't be reproduced with the provided example so it got closed: https://bugs.chromium.org/p/chromedriver/issues/detail?id=4446

If you have a reproducible example, please open a new ticket

@disposablecarcass
Copy link

disposablecarcass commented Dec 9, 2023

@disposablecarcass looks like a ticket was opened, but couldn't be reproduced with the provided example so it got closed: https://bugs.chromium.org/p/chromedriver/issues/detail?id=4446

If you have a reproducible example, please open a new ticket

thanks. I read thru his instructions in the link you provided and that user describes the issue perfectly. do you know what issues they had reproducing this? did they just not want to install the extension? if so I could upload my whole python project with the crx already moved to the project root. would that help? please let me know if that would be sufficient for someone to reproduce the error. thanks

Edtit: I've created a new issue: https://bugs.chromium.org/p/chromedriver/issues/detail?id=4660

@diemol
Copy link
Member

diemol commented Dec 9, 2023

You'd need to ask that in the Chrome bug tracker.

@NCLnclNCL
Copy link

@disposablecarcass looks like a ticket was opened, but couldn't be reproduced with the provided example so it got closed: https://bugs.chromium.org/p/chromedriver/issues/detail?id=4446
If you have a reproducible example, please open a new ticket

thanks. I read thru his instructions in the link you provided and that user describes the issue perfectly. do you know what issues they had reproducing this? did they just not want to install the extension? if so I could upload my whole python project with the crx already moved to the project root. would that help? please let me know if that would be sufficient for someone to reproduce the error. thanks

Edtit: I've created a new issue: https://bugs.chromium.org/p/chromedriver/issues/detail?id=4660

Because lava moat of metamask , you need disable it https://community.metamask.io/t/can-i-disable-lavamoat/24845/2

Copy link

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

@github-actions github-actions bot locked and limited conversation to collaborators Jan 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
G-chromedriver Requires fixes in ChromeDriver I-defect
Projects
None yet
Development

No branches or pull requests

6 participants