[BUG] Exception thrown when using playwright in a single-file published program
See original GitHub issueContext:
- Playwright Version: 1.24.1
- Operating System: Windows 10
- .NET version: .NET 6
- Browser: All
- Extra:
Code Snippet
See code to reproduce this bug here: https://github.com/resurge/PlaywrightSingleFilePathError
Describe the bug When publishing a project as single file and running the published executable the following error will be shown:
Unhandled exception. System.ArgumentException: The path is empty. (Parameter 'path')
at System.IO.Path.GetFullPath(String path)
at System.IO.FileInfo..ctor(String originalPath, String fullPath, String fileName, Boolean isNormalized)
at System.IO.FileInfo..ctor(String fileName)
at Microsoft.Playwright.Helpers.Driver.GetExecutablePath() in /_/src/Playwright/Helpers/Driver.cs:line 41
at Microsoft.Playwright.Transport.StdIOTransport.GetProcess() in /_/src/Playwright/Transport/StdIOTransport.cs:line 119
at Microsoft.Playwright.Transport.StdIOTransport..ctor() in /_/src/Playwright/Transport/StdIOTransport.cs:line 44
at Microsoft.Playwright.Playwright.CreateAsync() in /_/src/Playwright/Playwright.cs:line 44
at Program.<Main>$(String[] args) in C:\Users\jeroe\Documents\repos\PlaywrightSingleFilePathError\Program.cs:line 3
at Program.<Main>(String[] args)
I would expect the program to behave the same way as a regular Debug or Release build.
But choosing to publish as a single file causes the behaviour of the executable to change. (And not work)
The following tickets were about the same bug but were closed because of no code to reproduce:
- https://github.com/microsoft/playwright-dotnet/issues/1952
- https://github.com/microsoft/playwright-dotnet/issues/1527
EDIT: Some other issues I found relating to this bug:
- https://github.com/microsoft/playwright-dotnet/issues/1069
Not sure how the solution here works because
Playwright.CreateAsync
doesn´t accept parameters. - https://github.com/microsoft/playwright-dotnet/issues/1274 This ticket is closed with comment “not supported”, but no reason is given as to why not.
Issue Analytics
- State:
- Created a year ago
- Reactions:8
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Use throwException in Playwright Internal With Examples
Use the throwException method in your next Playwright Internal project with LambdaTest Automation Testing Advisor. Learn how to set up and run automated ......
Read more >Playwright error handling - Huurnerweg 4, Wierden
During handling of the above exception Window Handling | Playwright - Part ... INFSR (*PSSR) Second way is to use *PSSR program error...
Read more >Best Practices
This guide should help you to make sure you are following our best practices and writing tests that are more resilient.
Read more >Playwright error (Target closed) after navigation
In my case the Playwright error Target closed appeared at the first attempt to retrieve a text from the page. The error is...
Read more >Changelog | Cypress Documentation
Fixed an issue where using Cypress.require() would throw the error Cannot find ... Updated the Debug page sidebar badge to to show 0...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
While that seems to be the initial reason Playwright was created it is used for more that that.
I myself use it for scraping or transforming html to PDF. I would like to be able to share a single executable with users instead of having to make a zip file or installer as release.
I agree more with the description that is written in the README of this repo.
(Browser automation in general, not just specifically for testing)
The linked issues show that there is a need for this type of publishing.
EDIT: I found some more tickets about people using it this way, I added them above.
@mxschmitt any update on this open issue?