getgauge / taiko

A node.js library for testing modern web applications
https://taiko.dev
MIT License
3.56k stars 452 forks source link

Taiko with Firefox browser - Error: The Browser instance was closed either via `closeBrowser()` call, or it exited for reasons unknown to Taiko. You can try launching a fresh instance using `openBrowser()` or inspect the logs for details of the possible crash. #2698

Closed karishmayadava23 closed 9 months ago

karishmayadava23 commented 1 year ago

Discussed in https://github.com/getgauge/taiko/discussions/2697

Originally posted by **karishmayadava23** April 11, 2023 Hi Team, Note - I did set the system env variable to executable firefox file path. While launching taiko with Firefox getting below issues 1. npx taiko scriptfile.js - Launching the firefox with below error and terminating the execution ![image](https://user-images.githubusercontent.com/59534066/231203922-88c85cdb-67cc-493f-80ca-19edbb22e60f.png) 2. npx taiko - launching browser , and displaying the same error but not getting out of the repl mode. For performed action displaying no logs on terminal such that navigated to url . when gave closeBrowser() terminal displays browser is closed but it is not ![image](https://user-images.githubusercontent.com/59534066/231204661-3fc7b7e9-a85b-4827-97f5-5fa887db6fcc.png) taiko version - Version: 1.3.9 (Chromium: 110.0.5478.0) RELEASE node version - v18.15.0 firefox nightly version - ![image](https://user-images.githubusercontent.com/59534066/231207013-56bcfe43-5a47-45a2-a756-9a1226e2729e.png)
maxshifrin commented 9 months ago

Did you manage to solve the above? I am facing a similar issue with chrome, once every dozen executions or so, and wasn't able to handle it yet... (try/catch doesn't help)

DCoomer commented 9 months ago

Can you share what your code looks like?

maxshifrin commented 9 months ago

Sorry, I cannot share the code, the structure is very simple - it opens a browser, with some flags, runs some tests and continues over and over..

After long analysis it is discovered that if there are certain network issues, which the browser faces when trying to surf the web, Taiko is unable to handle them and thinks the browser was closed (hence throws this error).

In our case it ended up being some network misconfiguration, which we fixed, and made the issue go away - but probably proper error handling needs to be added to Taiko for these.