python-client icon indicating copy to clipboard operation
python-client copied to clipboard

self.driver.window_handles returns the list randomly

Open ammaramja opened this issue 1 year ago • 2 comments

The problem

self.driver.window_handles returns the list randomly, earlier the latest window handle used to be max from the list, now its neither max nor latest element of the array i.e -1 so there is no concrete way to switch to the latest window.

Environment

  • Appium version: 2.13.1
  • Last Appium version that did not exhibit the issue (if applicable): 1.65
  • Desktop OS/version used to run Appium:
  • Node.js version (unless using Appium.app|exe): v18.19.1
  • Mobile platform/version under test: Samsung S23 FE
  • Real device or emulator/simulator:
  • Appium CLI or Appium.app|exe:

Link to Appium Logs

appium_server_logs_11-27-37.log

Create a GIST which is a paste of your full Appium logs, and link them here.

Code To reproduce issue

        ```
        self.appium_opr.switch_context(self.instance, "web")
        time.sleep(CONTEXT_WAIT)
        all_windows = self.instance.window_handles
        window_after = max(all_windows)
        self.instance.switch_to.window(window_after)
        url = self.instance.current_url

ammaramja avatar Dec 16 '24 06:12 ammaramja

AFAIK the standard does not define any particular order in there. Reordering returned handles forcefully would be a breaking change.

mykola-mokhnach avatar Dec 16 '24 07:12 mykola-mokhnach

Btw, is it by chromedriver behavior thing?

KazuCocoa avatar Dec 19 '24 05:12 KazuCocoa