Issue: Playwright Browser Launch Timeout Error
Description: I am encountering an issue where the browser fails to launch within the expected time frame when running the Playwright script. The specific error I am seeing is a TimeoutError while trying to launch the browser in a persistent context. The browser (Firefox) does not launch within the 180-second timeout limit, leading to a timeout exception.
I have attempted to reinstall Playwright and the necessary browsers, but the issue persists. Additionally, I’ve seen multiple warning messages related to unrecognized flags and configuration issues.
Error Log Snippets: Timeout Error:
makefile Copy code playwright._impl._errors.TimeoutError: BrowserType.launch_persistent_context: Timeout 180000ms exceeded. Headless Mode Warning:
csharp Copy code [pid=14144][out] console.error: "Warning: unrecognized command line flag" "-disable-dev-shm-usage" [pid=14144][out] console.error: "Warning: unrecognized command line flag" "-disable-gpu" Search Engine Configuration Error:
csharp Copy code [pid=14144][out] console.error: SearchEngineSelector: "Received empty search configuration!" Steps Taken So Far: Reinstalled Playwright and Browsers: I have tried reinstalling Playwright and the required browsers:
bash Copy code pip uninstall playwright pip install playwright playwright install The issue continues after this.
Checked Browser Flags and Configuration: There are warnings about unrecognized command-line flags, such as -disable-dev-shm-usage and -disable-gpu. The browser is launching in headless mode, and additional errors related to search engine configuration are being logged.
Request for Assistance: I am looking for guidance on resolving the timeout error, handling the browser flags correctly, and ensuring that the browser launches properly within the specified timeout. Any help in identifying the root cause or potential solutions would be greatly appreciated.
[pid=14144][out] console.error: "Warning: unrecognized command line flag" "-disable-dev-shm-usage" [pid=14144][out] console.error: "Warning: unrecognized command line flag" "-disable-gpu"
Try commenting out the argument tags passed to the browser, this is the first step I would take.
Issue Description:
I'm encountering a TimeoutError when attempting to launch a Firefox browser in headless mode using Playwright. The error occurs during the authentication phase when the application attempts to connect to the Quotex API. It seems related to the launch_persistent_context method, where the browser fails to launch within the specified timeout period, exceeding 180,000 ms (3 minutes). Here's the traceback of the error:
playwright._impl._errors.TimeoutError: BrowserType.launch_persistent_context: Timeout 180000ms exceeded.
Additionally, I am seeing multiple warnings and errors from Firefox, indicating issues with command-line flags and rendering problems:
*** You are running in headless mode.
Warning: unrecognized command line flag "-disable-dev-shm-usage"
...
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
...
Other relevant logs:
- JavaScript errors like:
"Received empty search configuration!" "SearchEngineSelector: Failed to get engine data from Remote Settings" - Multiple
TypeError: this.transport.sendMessage is not a functionerrors from the Juggler pipe.
Additional Issue: Along with the above error, I am also facing an issue where the terminal continuously displays "Reactivating terminals..." without stopping. This message runs indefinitely, preventing any further progress or termination of the process. The terminal doesn't stop even after several minutes.
System Details:
- Python 3.x
- Playwright version: [version]
- Firefox version: [version] (used by Playwright)
- Operating System: [Windows/Mac/Linux, specify version]
- Virtual Environment: Yes (activated using
myenv)
What I’ve Tried:
- Reinstalling Playwright and the necessary browser binaries.
- Modifying the timeout to increase it to 60 seconds.
- Running the browser in non-headless mode to check if it's related to headless rendering.
- Clearing Playwright cache using
playwright install --force. - Trying Chrome as an alternative browser (
chromium.launch()), which works without issues. - Checking for any infinite loops or hanging processes that may be causing the terminal to keep "reactivating."
Request: Could you help me identify the root cause of this error? I suspect the problem may be related to either system performance, specific flags for Firefox in headless mode, or some Playwright configuration. Additionally, I am unsure why the terminal continues to display the "Reactivating terminals..." message indefinitely, preventing further progress. Any recommendations or solutions would be highly appreciated.
Hello, I believe I might have made a mistake while cloning or running the project. I am encountering several errors, including a TimeoutError when launching the browser with Playwright, and the terminal is stuck on "Reactivating terminals..." without stopping.
Could you please provide detailed, step-by-step instructions on how to correctly clone and run the project without errors? I would appreciate clear guidance on setting up the environment, installing dependencies, and executing the application so that everything runs smoothly.
Hello, I believe I might have made a mistake while cloning or running the project. I am encountering several errors, including a TimeoutError when launching the browser with Playwright, and the terminal is stuck on "Reactivating terminals..." without stopping.
Could you please provide detailed, step-by-step instructions on how to correctly clone and run the project without errors? I would appreciate clear guidance on setting up the environment, installing dependencies, and executing the application so that everything runs smoothly.
First do this : https://github.com/cleitonleonel/pyquotex/issues/42#issuecomment-2518536081
After that, tell me if there is a config.ini file in a settings folder.
If this folder and files exist, please let me know the contents of the file. Finally, it is worth remembering that the steps to install the lib are simple steps like any other python lib, just clone the project or download it as a zip and unzip it. Install the dependencies as described in the project readme and run the main file with a valid argument, this information is very clear in the project readme.
i am always getting this error, do you have solution?
PS C:\Users\iLyaz\Documents\Python Scripts\Qxbroker> & C:/Users/iLyaz/AppData/Local/Programs/Python/Python312/python.exe "c:/Users/iLyaz/Documents/Python Scripts/Qxbroker/p1.py"
Quotex Connecting...
Traceback (most recent call last):
File "c:\Users\iLyaz\Documents\Python Scripts\Qxbroker\p1.py", line 527, in
await self._impl_obj.launch_persistent_context(
File "C:\Users\iLyaz\AppData\Local\Programs\Python\Python312\Lib\site-packages\playwright_impl_browser_type.py", line 159, in launch_persistent_context
from_channel(await self._channel.send("launchPersistentContext", params)),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\iLyaz\AppData\Local\Programs\Python\Python312\Lib\site-packages\playwright_impl_connection.py", line 61, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\iLyaz\AppData\Local\Programs\Python\Python312\Lib\site-packages\playwright_impl_connection.py", line 528, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TimeoutError: BrowserType.launch_persistent_context: Timeout 180000ms exceeded.
Call log:
-
C:\Users\iLyaz\AppData\Local\ms-playwright\firefox-1466\firefox\firefox.exe -no-remote -headless -profile browser -juggler-pipe --disable-dev-shm-usage --disable-accelerated-2d-canvas --disable-gpu --disable-web-security --no-sandbox --aggressive-cache-discard --disable-cache --disable-application-cache --disable-offline-load-stale-cache --disk-cache-size=0 --disable-background-networking --disable-default-apps --disable-extensions --disable-sync --disable-translate --hide-scrollbars --metrics-recording-only --mute-audio --safebrowsing-disable-auto-update --ignore-certificate-errors --ignore-ssl-errors --ignore-certificate-errors-spki-list --disable-features=LeakyPeeker --disable-setuid-sandbox about:blank -
-
pid=327540
-
-
- [pid=327540][err] *** You are running in headless mode.
-
- [pid=327540][out] console.warn: services.settings: Ignoring preference override of remote settings server
-
- [pid=327540][out] console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
-
- [pid=327540][out]
-
- [pid=327540][out] Juggler listening to the pipe
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-disable-dev-shm-usage"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-disable-gpu"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-no-sandbox"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-disable-cache"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-disable-offline-load-stale-cache"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-disable-background-networking"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-disable-extensions"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-disable-translate"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-metrics-recording-only"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-safebrowsing-disable-auto-update"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-ignore-ssl-errors"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-disable-features"
-
- [pid=327540][out] console.error: "Warning: unrecognized command line flag" "-disable-setuid-sandbox"
-
- [pid=327540][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt (t=8.28917) [GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
-
- [pid=327540][out] console.error: SearchEngineSelector: "Received empty search configuration!"
-
- [pid=327540][err] JavaScript error: chrome://juggler/content/Helper.js, line 82: NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebProgress.removeProgressListener]
-
- [pid=327540][out] console.error: "Received empty top sites configuration!"
-
- [pid=327540][out] console.error: SearchEngineSelector: "Received empty search configuration!"
-
- [pid=327540][out] console.error: SearchService: "#init: failure initializing search:" ({})
- 4 × [pid=327540][err] JavaScript error: resource://gre/modules/SearchEngineSelector.sys.mjs, line 88: NS_ERROR_UNEXPECTED: Failed to get engine data from Remote Settings
-
- [pid=327540][out] console.error: "Received empty top sites configuration!"
-
- [pid=327540][out] console.error: WebExtensions:
-
- [pid=327540][out] Message: [Exception... "Failed to get engine data from Remote Settings" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: resource://gre/modules/SearchEngineSelector.sys.mjs :: getEngineConfiguration :: line 88" data: no]
-
- [pid=327540][out] Stack:
-
- [pid=327540][out] getEngineConfiguration@resource://gre/modules/SearchEngineSelector.sys.mjs:88:24
-
- [pid=327540][out]
-
- [pid=327540][out] console.error: ({})
-
- [pid=327540][out] console.error: URLBar - Provider.UrlbarProviderSearchTips: ({})
-
- [pid=327540][out] console.error: SearchSettings: "_write: Could not write to settings file:" (new Error("cannot write without any engine.", "resource://gre/modules/SearchSettings.sys.mjs", 335))
Steps I Followed: Installed Required Dependencies:
I followed the setup instructions, installed all the required dependencies, and set up the virtual environment as mentioned in the documentation. Configured config.ini:
I provided my account details and the necessary paths in the config.ini file as shown below:
ini Copy code [settings] email=xxxxxxxxxxxxxxxxxxxxx password=xxxxxxxxxxxxxxxxx email_pass=xxxxxxxxxxxxxxxx user_data_dir=C:\Users\hp\AppData\Local\Google\Chrome\User Data\Profile 1 The script is supposed to use this configuration for logging in and running the automated tasks.
Issues I Encountered: Timeout Error: When I run the script, I encounter a TimeoutError after launching the browser. The error message is as follows:
plaintext Copy code playwright._impl._errors.TimeoutError: BrowserType.launch_persistent_context: Timeout 180000ms exceeded. This occurs while trying to launch a persistent browser context with Playwright. The browser (Firefox) is started, but it doesn’t complete the initialization process within the allowed time frame.
Error Logs: Here is the log of the error when I run the script:
plaintext
Copy code
playwright._impl._errors.TimeoutError: BrowserType.launch_persistent_context: Timeout 180000ms exceeded.
Call log:
-
pid=23876 - [pid=23876][err] *** You are running in headless mode. It seems like the script is unable to complete the browser initialization due to this timeout error.
What I’ve Tried So Far: I have checked the configuration file, and all paths and credentials seem correct. I’ve tried adjusting the timeout settings, but the issue persists. I’ve also ensured that the required browsers are installed and up to date (Firefox in this case). What I Need Help With: Timeout Error:
Can you suggest a solution for the timeout error that occurs during the browser launch? Do I need to adjust any settings related to the Playwright or the browser context? Possible Configuration Issues:
Are there any issues with the config.ini file or browser profile settings that might be causing this problem? Should I adjust the browser flags or profile settings to avoid this timeout? General Troubleshooting:
Any additional troubleshooting steps you can recommend for resolving this issue would be greatly appreciated. Summary of Configuration (config.ini): ini Copy code [settings] email=xxxxxxxxxxxxxxxxxxxxxx password=xxxxxxxxxxxxxxxxxx email_pass=xxxxxxxxxxxxxxxx user_data_dir=C:\Users\hp\AppData\Local\Google\Chrome\User Data\Profile 1 Thank you for your help! I look forward to your suggestions on how to fix the issues I’m facing.
Best regards,
playwright._impl._errors.TimeoutError: BrowserType.launch_persistent_context: Timeout 180000ms exceeded. This occurs while trying to launch a persistent browser context with Playwright. The browser (Firefox) is started, but it doesn’t complete the initialization process within the allowed time frame.
Try this, comment the line.
Thank you so much for your help and suggestions! I really appreciate the time you took to assist me with the issue I was facing with the pyquotex library. Your advice was incredibly useful, and following your suggestions, I was able to resolve the problem and get everything working as expected.
Your support means a lot, and I’ll definitely keep this library in mind for future projects. Thanks again for being so responsive and helpful!
Best regards,
i opened qxbroker.py and changed True to False on line number 86 and 95 then ran python app.py which opened the window for quotex website then automaticly logged in and crashed then i revert back the changes i made to qxbroker.py and ran python app.py get_realtime_candle and it worked .
note :- i did not comment any line
edit:- the issue started ones again after sometime so i did the above steps again and worked