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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: __name is not defined #13724

Closed
Javarome opened this issue Mar 22, 2024 · 6 comments
Closed

[馃悰 Bug]: __name is not defined #13724

Javarome opened this issue Mar 22, 2024 · 6 comments

Comments

@Javarome
Copy link

Javarome commented Mar 22, 2024

What happened?

My goal is to read the href of a anchor link, which should easily be accessible through const url = await anchorElement.getAttribute("href"). However when invoking this method Chrome returns a JavaScript error saying that __name is not defined.

When debugging the problem, I found out that the getAttribute function sent to Chrome indeed repeatedly calls a __name(someFunc, someStr) function, but __name is defined nowhere in the scope of that code.

How can we reproduce the issue?

const driver = await new Builder().forBrowser(Browser.CHROME).build()
await this.driver.manage().setTimeouts({implicit: 5000});
await driver.get("https://www.ufo-search.com/timeline/search.html?sy=1977&ey=1977&sm=3&em=3")
const rowEls = await driver.findElements(By.css("#output hr + p"))
const fieldsHeadings = await row.findElements(By.css("strong"))
const dateLabel = fieldsHeadings[0]
const dateLink = await dateLabel.findElement(By.xpath("following-sibling::a"))
const url = await dateLink.getAttribute('href')  // Error

Relevant log output

JavascriptError: javascript error: __name is not defined
  (Session info: chrome=123.0.6312.59)
    at Object.throwDecodedError (/Users/javarome/project/@rr0/rr0.org/node_modules/selenium-webdriver/lib/error.js:521:15)
    at parseHttpResponse (/Users/javarome/project/@rr0/rr0.org/node_modules/selenium-webdriver/lib/http.js:510:13)
    at Executor.execute (/Users/javarome/project/@rr0/rr0.org/node_modules/selenium-webdriver/lib/http.js:443:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Driver.execute (/Users/javarome/project/@rr0/rr0.org/node_modules/selenium-webdriver/lib/webdriver.js:740:17)
 {
  remoteStacktrace: '0   chromedriver                        0x00000001009a43e8 chromedriver + 4326376\n' +
    '1   chromedriver                        0x000000010099c8b0 chromedriver + 4294832\n' +
    '2   chromedriver                        0x00000001005c8088 chromedriver + 278664\n' +
    '3   chromedriver                        0x00000001005ccabc chromedriver + 297660\n' +
    '4   chromedriver                        0x00000001005ce684 chromedriver + 304772\n' +
    '5   chromedriver                        0x0000000100643f30 chromedriver + 786224\n' +
    '6   chromedriver                        0x00000001006434f8 chromedriver + 783608\n' +
    '7   chromedriver                        0x00000001005ff4e4 chromedriver + 505060\n' +
    '8   chromedriver                        0x00000001005fff5c chromedriver + 507740\n' +
    '9   chromedriver                        0x0000000100967984 chromedriver + 4077956\n' +
    '10  chromedriver                        0x000000010096c73c chromedriver + 4097852\n' +
    '11  chromedriver                        0x000000010094e528 chromedriver + 3974440\n' +
    '12  chromedriver                        0x000000010096d054 chromedriver + 4100180\n' +
    '13  chromedriver                        0x000000010093fb18 chromedriver + 3914520\n' +
    '14  chromedriver                        0x000000010098d65c chromedriver + 4232796\n' +
    '15  chromedriver                        0x000000010098d7d8 chromedriver + 4233176\n' +
    '16  chromedriver                        0x000000010099c524 chromedriver + 4293924\n' +
    '17  libsystem_pthread.dylib             0x0000000186b4e034 _pthread_start + 136\n' +
    '18  libsystem_pthread.dylib             0x0000000186b48e3c thread_start + 8\n'
}

Operating System

MacOS 14.3.1 (23D60) / Sonoma

Selenium version

4.18.1

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

Chrome 123.0.6312.59

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

idk, just used Selenium 4.18.1 and it works like that

Are you using Selenium Grid?

No

Copy link

@Javarome, 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 Mar 23, 2024

Does the issue happen if you try with Firefox?

@Javarome
Copy link
Author

Yes, same error (but without the Chrome session info)

JavascriptError: ReferenceError: __name is not defined
    at Object.throwDecodedError (/Users/javarome/project/@rr0/rr0.org/node_modules/selenium-webdriver/lib/error.js:521:15)
    at parseHttpResponse (/Users/javarome/project/@rr0/rr0.org/node_modules/selenium-webdriver/lib/http.js:510:13)
    at Executor.execute (/Users/javarome/project/@rr0/rr0.org/node_modules/selenium-webdriver/lib/http.js:443:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Driver.execute (/Users/javarome/project/@rr0/rr0.org/node_modules/selenium-webdriver/lib/webdriver.js:740:17)

@titusfortner
Copy link
Member

This reminds me of the issue we had with the isDisplayed.js atom.
I'm not a JS expert here, but it looks like a variable naming collision with the use of the getAttribute.js atom.

The easiest fix for the user here is to use either getDomAttribute() or getProperty() instead of getAttribute()

@harsha509
Copy link
Member

Hi @Javarome,

Thank you for bringing up the issue.

I attempted to reproduce the problem using the provided code sample, but I couldn't encounter the specified issue. Could you please confirm if this problem still persists for you?

Thanks,
Sri

Copy link

github-actions bot commented May 1, 2024

This issue was closed because we did not receive any additional information after 14 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants