Closed ahalbrock closed 4 days ago
@ahalbrock, thank you for creating this issue. We will troubleshoot it as soon as we can.
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!
Duplicate of #14181 and the underlying issue is #12549
Agreed that this is likely a duplicate of https://github.com/SeleniumHQ/selenium/issues/14181 but https://github.com/SeleniumHQ/selenium/issues/12549 seems to be what caused the underlying issue to be apparent (swapping a "this" of { navigator: window.navigator, document: window.document } for just "window"). The issue seems to be the atoms deciding to write the function needing to be called to this. for no apparent reason before calling. If we're passing in window as "this" it doesn't seem advisable to overwrite chunks of in EVERY atom. I don't think we need "this. = mainFunc; return this._.apply(null, arguments)" when just "return mainFunc.apply(null, arguments)" seems to do the same job without potentially overwriting important properties of "window".
The code in Selenium right now is not what the Appium atoms are currently using. We reverted the code that was used to build those atoms.
If you have a code for #12549 that fixes the issue for Appium, please PR.
What happened?
The javascript atoms here are used, I'm told, verbatim in the appium-remote-debugger project. When using Appium 2+ and switching the xcuitest driver for automation over to a webview context, these atoms are used to interact with the page. In the past "this" was given a cherry picked version of window as "this", one that really just contained window.navigator and window.document, but the newest versions seem to just pass "window" as is for "this".
The atoms seem to follow a pattern of having a main driving function defined that wrangles together all the other code present in the atom assigned to what is basically "this." and then end with a "return this..apply(null, arguments)" The previous cherry picked version of window (a new object that referenced window.navigator and window.document) didn't run into issues since the cherry picked object assigned to "this" didn't have "" defined, but for any application that does have window. defined, this causes underscore to be overwritten and can cause all kinds of issues.
If instead the driving function is not assigned to "this._" but instead invoked directly, e.g. "return DRIVINGFUNC.apply(null, arguments)", this clobbering of window. does not occur and we don't see any consequences.
How can we reproduce the issue?
Relevant log output
Operating System
MacOS 13.6.6
Selenium version
appium-remote-debugger claims use of 4.19.0 for atoms.
What are the browser(s) and version(s) where you see this issue?
iPhone 12 - iOS 17.4.1 and iPhone 7 iOS 15.8.2
What are the browser driver(s) and version(s) where you see this issue?
appium-XCUITest-driver 7.17.6 (but have seen this issue since much earlier versions used with Appium 2.
Are you using Selenium Grid?
No