question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UI tests fail to communicate with chrome after receiving `Target.detachedFromTarget` event

See original GitHub issue

Issue

We’re seeing some unexpected errors during our tests like:

18:32:36.707 [main] WARN  c.i.k.driver.chrome_1647127935267 - waitUntil evaluate failed: failed to get reply for: [id: 141, sessionId: 2FDE9D3A8B4E3072420A4E591E5E0ACA, method: Runtime.evaluate, params: {"expression":"(function(){ var fun = function(_){ return _.textContent.includes('Success!') }; var e = document.querySelector(\"body\"); return fun(e) })()","returnByValue":true}]

After some investigation, it seems that all communication with chrome fails after receiving a Target.detachedFromTarget event:

websocket received text
<< {"method":"Target.detachedFromTarget","params":{"sessionId":"3E78AB1A4E9D86127767FB34AEB05AE0","targetId":"959F5DA50726B2D860A1AC58225E04A8"},"sessionId":"50BCEAE7F724D8D54F5FA85483BF4D07"}
<< ignore: [id: null, sessionId: 50BCEAE7F724D8D54F5FA85483BF4D07, method: Target.detachedFromTarget, params: {"sessionId":"3E78AB1A4E9D86127767FB34AEB05AE0","targetId":"959F5DA50726B2D860A1AC58225E04A8"}]

Notes

We are still able to successfully send raw messages using the method described at https://github.com/karatelabs/karate/blob/master/examples/ui-test/README.md#devtools-protocol-tips even after observing a Target.detachedFromTarget event. In other words, it seems chrome / chrome debugging is still functioning properly but Karate is unable to communicate with it.

Background

Our “real” tests are failing when testing credit card entry which is powered by Stripe. Stripe uses the same pattern we’ve distilled in the attached reproducer to securely process credit card payments. In other words, we are unable change the underlying application to workaround this issue.

Reproducer:

How to run:

  1. build / install maven artifacts from latest develop branch locally
mvn clean install -P pre-release -pl -karate-robot
  1. run test in reproducer:
mvn test

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
joelpramoscommented, Mar 19, 2022

Leaving this link here for googles to connect the two: https://github.com/karatelabs/karate/issues/1715

thanks @jkeys089 - everything seems to be passing in the CICD

1reaction
ptrthomascommented, Mar 16, 2022

@jkeys089 thank you ! I’ll keep this open until the “formal” 1.2.0 release, that’s just the process we follow for this project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Protocol error (Target.createTarget): Target closed. #1947
Can you post the stack trace along with the error? The only usage of Target.createTarget in Puppeteer is in browser.newPage() .
Read more >
UI Testing Failure due to failed A… | Apple Developer Forums
When I run a UI Test in Xcode 7, the line XCUIApplication().launch() causes the test to fail under the "Wait for app to...
Read more >
[karate]: Karate UI Automation: Unable to launch the browser
The compiler is looking target folder for the chrome ...
Read more >
Google Chrome: Unable to run automated tests
You can resolve this issue in one of two ways: Option #1: Manually reconfigure Chrome. Follow the steps below: Stop the currently running...
Read more >
422218 - Chrome 38 doesn't work anymore with Karma test ...
The problem appears when running the Karma webserver for automated JS unit testing together with Chrome, ONLY from a UI-less build agent.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found