Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Browsers are not working #1620

Closed
Maxim1-1 opened this issue Jul 3, 2024 · 11 comments
Closed

[Bug]: Browsers are not working #1620

Maxim1-1 opened this issue Jul 3, 2024 · 11 comments

Comments

@Maxim1-1
Copy link

Maxim1-1 commented Jul 3, 2024

Version

1.45

Steps to reproduce

  1. Clone the repository https://github.com/Maxim1-1/Playwright
  2. Replace line 13 with "Browser browser = playwright.firefox().launch(new Browser Type.Launch Options().set Headless(false));"
  3. Run the program

Expected behavior

the firefox browser window has opened

Actual behavior

at org.example.Main.main(Main.java:13)

Caused by: com.microsoft.playwright.impl.DriverException: Error {
message='Executable doesn't exist at C:\Users{max}\AppData\Local\ms-playwright\firefox-1454\firefox\firefox.exe
╔════════════════════════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install" ║
║ ║
║ <3 Playwright Team ║
╚════════════════════════════════════════════════════════════════════════════════════════════╝
name='Error
stack='Error: Executable doesn't exist at C:\Users{max}\AppData\Local\ms-playwright\firefox-1454\firefox\firefox.exe
╔════════════════════════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install" ║
║ ║
║ <3 Playwright Team ║
╚════════════════════════════════════════════════════════════════════════════════════════════╝

Additional context

my firefox and webkit browser won't start. I executed the "mvn exec" command several times:java -dexec.MainClass=com.microsoft.playwright.CLID exec.args="install"", also tried the command from the documentation "mvn exec:java -e -D exec.MainClass=com.microsoft.playwright.CLI -D exec.args="install webkit"" to which I received the error "error:unknown command 'install webkit'".
I went to the folder "C:\Users {user}\AppData\Local\ms-playwright\firefox-1454\firefox\firefox.exe " and I didn't find an executable file there firefox.exe . The situation is similar with webkit.

Please fix this moment or tell me what I'm doing wrong. Thank you very much.

Environment

windows 10, Java 21.
@mxschmitt mxschmitt transferred this issue from microsoft/playwright Jul 4, 2024
@mxschmitt
Copy link
Member

Looks similar to #1542 - I'm unfortunately not proficient with Maven, waiting for Yury to come back. You are mentioning a repository, which one is it?

Maybe similar to mojohaus/exec-maven-plugin#421.

@Maxim1-1
Copy link
Author

Maxim1-1 commented Jul 4, 2024

Sorry, this repository https://github.com/Maxim1-1/Playwright

@mxschmitt
Copy link
Member

I tried to reproduce but was not able to. I used:

PS C:\Users\maxschmitt\Developer\tmp\playwight-repro> java --version
openjdk 21.0.3 2024-04-16 LTS
OpenJDK Runtime Environment Zulu21.34+19-CA (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Zulu21.34+19-CA (build 21.0.3+9-LTS, mixed mode, sharing)
PS C:\Users\maxschmitt\Developer\tmp\playwight-repro> mvn --version
Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
Maven home: C:\Program Files\apache-maven
Java version: 21.0.3, vendor: Azul Systems, Inc., runtime: C:\Program Files\Zulu\zulu-21
Default locale: en_US, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"
PS C:\Users\maxschmitt\Developer\tmp\playwight-repro> 

Which Java and Maven are you using? I'm not a Java expert, but would guess that the Java version/brand (since I'm using Zulu) doesn't make a big difference there, maybe the Maven version.

@Maxim1-1
Copy link
Author

Maxim1-1 commented Jul 5, 2024

maven version 3.9.2. do all types of browsers work correctly? do you have an executable file firefox.exe or webkit.exe Along the way C:\Users {user}\AppData\Local\ms-playwright\firefox-1454\firefox\firefox.exe or along the way C:\Users {user}\AppData\Local\ms-playwright\firefox-1454\webkit\webkit.exe? Thanks.

@Maxim1-1
Copy link
Author

Maxim1-1 commented Jul 5, 2024

I switched to version 1.43 and everything worked at first, then I cleaned up the project again, switched to 1.45 and get the same error as before. At first glance, the downloaded files for firefox, chromium, and webkit browsers for different versions of playwright are no different. I can't figure out what's going on. I tried to run it again on version 1.43, then I got this error: [Error: EPERM: operation not permitted, open 'C:\Users{user}\AppData\Local\ms-playwright\firefox-1447\firefox\firefox.exe'] {
errno: -4048,
code: 'EPERM',
syscall: 'open',
path: 'C:\Users\{user}\AppData\Local\ms-playwright\firefox-1447\firefox\firefox.exe'
}
Failed to install browsers
Error: Failed to download Firefox 124.0 (playwright build v1447), caused by
Error: Download failure, code=1
at ChildProcess. (C:\Users\MAKSGO~1\AppData\Local\Temp\playwright-java-16452516271830092356\package\lib\server\registry\browserFetcher.js:91:16)
at ChildProcess.emit (node:events:518:28)
at ChildProcess._handle.onexit (node:internal/child_process:294:12)
Exception in thread "main" java.lang.RuntimeException: Failed to create driver

Webkit works everywhere, just like chromium.

@Maxim1-1
Copy link
Author

Maxim1-1 commented Jul 5, 2024

I also deleted the Node js-cache folder (or something like that) and now, when starting the program, regardless of which browser and regardless of the version of playwright, the program tries to install browsers but fails due to an attempt to install firefox. Now it doesn't work for me at all(

@Maxim1-1
Copy link
Author

Maxim1-1 commented Jul 5, 2024

After a couple of hours of experimenting with finding the cause, a simple restart of the computer helps. If you have problems installing any browser, just restart your computer and restart the program, and playwright will download the desired browser.

@mxschmitt
Copy link
Member

So everything is working now? Maybe helpful for others, how did you fix #1620 (comment)?

Looking at "error:unknown command 'install webkit'".

@Maxim1-1
Copy link
Author

Maxim1-1 commented Jul 6, 2024

As I understand it, you just need to restart the computer, and then re-launch the playwright, and the desired browser will be downloaded.

@mxschmitt
Copy link
Member

Looks like some transient issue, I'll close it for now. If you have something you can reproduce, feel free to re-file with exact reproduction steps. Thanks!

@Maxim1-1
Copy link
Author

Maxim1-1 commented Jul 7, 2024

Good afternoon, yes of course. Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants