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

No Chrome browser web context after browser termination and relaunch #2062

Open
wazzeps opened this issue Oct 31, 2023 · 7 comments
Open

No Chrome browser web context after browser termination and relaunch #2062

wazzeps opened this issue Oct 31, 2023 · 7 comments

Comments

@wazzeps
Copy link
Contributor

wazzeps commented Oct 31, 2023

Description

After calling the terminateApp(String bundleId) method to close Chrome browser it has no web context after subsequent launch.

Environment

  • Java-client 8.5.0
  • Appium 2.1.3
  • uiautomator2@2.31.4
  • Android emulator

Details

We navigate from the application to the Chrome browser using a link, after which we clear the state of the browser, closing all tabs and destroying the browser. When we try to navigate from the application to the browser again, the driver does not find web context.

Code To Reproduce Issue [ Good To Have ]

Test 1

// tap a link in the app
// wait for the browser to open

((SupportsContextSwitching) driver).context("WEBVIEW_chrome");
driver.getWindowHandles().forEach(windowHandle -> driver.switchTo().window(windowHandle).close());
((InteractsWithApps) driver).terminateApp("com.android.chrome");

Test 2

// tap a link in the app
// wait for the browser to open

System.out.println(((SupportsContextSwitching) driver).getContextHandles());

Output: [NATIVE_APP]

Link To Appium Logs

Appium logs

@wazzeps
Copy link
Contributor Author

wazzeps commented Oct 31, 2023

Setting ensureWebviewsHavePages capability to false allows the driver to see the context but not switch to it.

@wazzeps
Copy link
Contributor Author

wazzeps commented Nov 20, 2023

@mykola-mokhnach could you please look into?

@mykola-mokhnach
Copy link
Contributor

Maybe the context is really not connectable. Are you able to connect to it with Chrome remote debugger in such state?

@wazzeps
Copy link
Contributor Author

wazzeps commented Nov 23, 2023

Yes I can connect and open tabs with remote debugger.

image

@wazzeps
Copy link
Contributor Author

wazzeps commented Nov 23, 2023

Sometimes I can see both contexts, but switching is not completed within the allotted time.

Appium logs

@mykola-mokhnach
Copy link
Contributor

Unfortunately I don't know how we can help there. Maybe try to report the issue to chromedriver.

@KazuCocoa
Copy link
Member

appium:showChromedriverLog may show more information. Although it looks like Chrome or chromedriver side's something.

Not for the version, but chrome v115+ has similar issue https://bugs.chromium.org/p/chromedriver/issues/detail?id=4595

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants