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.

[BUG] Exception thrown when using playwright in a single-file published program

See original GitHub issue

Context:

  • 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:

EDIT: Some other issues I found relating to this bug:

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:8
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jeroenpelgrimscommented, Aug 16, 2022

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)

Playwright for .NET is the official language port of Playwright, the library to automate Chromium, Firefox and WebKit with a single API.

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.

0reactions
vmeganathan81commented, Apr 7, 2023

@mxschmitt any update on this open issue?

Read more comments on GitHub >

github_iconTop 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 >

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