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.

Always downloading Playwright driver

See original GitHub issue

I noticed that in the current master branch it was always downloading the driver. I found the issue, in PlaywrightDriver.isUpToDateDriver It’s checking the output of PW, for example:

/Users/sam/Library/Caches/ms-playwright-go/1.16.0-next-1634703014000/playwright.sh --version
Version 1.16.0-next

With the constant:

const playwrightCliVersion = "1.16.0-next-1634703014000"

Using:

	if bytes.Contains(output, []byte(d.Version)) {
		return true, nil
	}

The extra -1634703014000 on the constant is the issue. I’ve fixed it locally by adding this to the end of isUpToDateDriver:

	if strings.HasPrefix(string(output), "Version ") {
		// Get rid of trailing new line
		outputStr := strings.TrimSpace(string(output))
		if len(outputStr) > 8 && strings.Contains(d.Version, outputStr[8:]) {
			return true, nil
		}
	}

I’ll submit a PR with the change.

If you have any suggestions for changes I’m happy to change.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AngangGuocommented, Jan 12, 2022

I have the same issue with the latest master branch. Every time I run the program, the driver will be downloaded again.

2022/01/12 09:06:00 report date is: 2022-01-11
2022/01/12 09:06:06 Downloading driver to C:\Users\caguoa00\AppData\Local\ms-playwright-go\1.16.3-1635814179000
2022/01/12 09:06:16 Downloaded driver successfully

go.mod

go 1.17

require github.com/mxschmitt/playwright-go v0.1400.1-0.20211124164553-ce64d8145ec8
0reactions
mxschmittcommented, Mar 12, 2022

This should be fixed in v1.20.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browsers - Playwright
By default, Playwright downloads browsers from Microsoft CDN. Sometimes companies maintain an internal proxy that blocks direct access to the public resources.
Read more >
[BUG] Playwright cannot download the browsers automatically
I'm trying to use Playwright in a Java EE environment with Zulu 11 and I always get this error messaged when launching chromium....
Read more >
Installation | Playwright
Playwright downloads Chromium, Firefox and WebKit browsers by default. To install a specific browser, pass it as an argument during installation. $ pip...
Read more >
4 - Playwright Setup & First Script - Launch Chromium, Firefox ...
Learn: --initial setup -- download browser binaries --first playwright script --launch chromium, firefox and webkit using playwright Schedule ...
Read more >
#25 - Download File using Playwright with Java - YouTube
In this video, I have explained how to Download File using Playwright with Java.Schedule a meeting in case of any ...
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