Running playwright with the local firefox - firefox

How do you run playwright with already installed local firefox?
NOTE!: I need to be able to specify the executable as I'm actually developing firefox so I may have a custom build. But, step one is getting it to run with an official build.
I tried this
// test.mjs
import { firefox } from 'playwright-core';
const executablePath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
async function main() {
const browser = await firefox.launch({
executablePath,
headless: false,
});
}
main();
but I get a bunch of errors
❯ node .\test.mjs
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
browserType.launch: Browser.enable): Browser closed.
==================== Browser output: ====================
<launching> C:\Program Files\Mozilla Firefox\firefox.exe -no-remote -wait-for-browser -foreground -profile C:\Users\gregg\AppData\Local\Temp\playwright_firefoxdev_profile-SMZBOF -juggler-pipe -silent
<launched> pid=10684
[pid=10684] <process did exit: exitCode=0, signal=null>
[pid=10684] starting temporary directories cleanup
=========================== logs ===========================
<launching> C:\Program Files\Mozilla Firefox\firefox.exe -no-remote -wait-for-browser -foreground -profile C:\Users\gregg\AppData\Local\Temp\playwright_firefoxdev_profile-SMZBOF -juggler-pipe -silent
<launched> pid=10684
[pid=10684] <process did exit: exitCode=0, signal=null>
[pid=10684] starting temporary directories cleanup
============================================================
at main (file:///C:/Users/gregg/src/gpuweb/cts/test.mjs:6:33)
at file:///C:/Users/gregg/src/gpuweb/cts/test.mjs:13:1 {
name: 'Error'
}
Tried MacOS as well as Window (of course on MacOS the path is different). This process works fine with Chrome

I believe your FF doesn't match the version Playwright supports,
The latest Playwright 1.29.2 supports 107, while the current FF is 108.
https://github.com/microsoft/playwright/issues/19337#issuecomment-1342247868

Related

Chocolatey freezes during upgrading any packege

When I thy to upgrade any packege (as superuser) chocolatey stacks at the point of "Performing other installation steps" and starts to load one core of the CPU with no changing at memory usage and with 0 disk usage:
You have Firefox v109.0.1 installed. Version 110.0 is available based on your source(s).
Progress: Downloading Firefox 110.0... 100%
Firefox v110.0 [Approved]
firefox package files upgrade completed. Performing other installation steps.
When I stop the process Chocolatey tells:
Exiting chocolatey abnormally. Please manually clean up anything that was not finished.
and things that packege was updated and assigns the new wersion to it, but it reality is was not apdated at all
How I can fix or at least debud the problem further?
Reinstalling Chocolatey did't fix the problem
System restoration to previous point did't fix the problem
Update 1:
After eneblind debug and verbose modes it tells:
freenet v0.7.5.1496 [Approved]
freenet package files upgrade completed. Performing other installation steps.
Setting installer args for freenet
Setting package parameters for freenet
Contents of 'C:\ProgramData\chocolatey\lib\freenet\tools\chocolateyInstall.ps1':
$ErrorActionPreference = 'Stop';
$packageArgs = #{
packageName = 'freenet'
fileType = 'exe'
url = 'https://github.com/freenet/fred/releases/download/build01496/FreenetInstaller-1496.exe'
silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-'
validExitCodes = #(0)
softwareName = 'Freenet*'
checksum = 'd88d37d2e212bf87d9710bc10b1d07f508944e052e1825220ed50310d717261d'
checksumType = 'sha256'
toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
}
Install-ChocolateyPackage #packageArgs
Calling built-in PowerShell host with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\freenet\tools\chocolateyInstall.ps1' -installArguments '' -packageParameters '' -preRunHookScripts $null -postRunHookScripts $null']
Redirecting System.Management.Automation.resources, Version=3.0.0.0, Culture=ru-RU, PublicKeyToken=31bf3856ad364e35, requested by ''
Update 2:
Logs (Pastebin)
Looks like it may be related to https://github.com/chocolatey/choco/issues/1312#issuecomment-753559904
So force-reinstalling chocolatey-core.extension (I used latest: 1.4.0 and Chocolatey GUI 1.1.1.0) fixed the problem

Error EOF when trying to resize images using Gulp on Windows

I get an error as follows when calling resize:images task in my gulpfile (see bottom) ...
events.js:160
throw er; // Unhandled 'error' event
^
Error: Error: write EOF
at finish (C:\Users\brendan\Documents\Code\Web\TheOrm\WWW\v3\node_modules\gulp-gm\index.js:40:21)
at gm.<anonymous> (C:\Users\brendan\Documents\Code\Web\TheOrm\WWW\v3\node_modules\async\lib\async.js:485:30)
at emitMany (events.js:127:13)
at gm.emit (events.js:201:7)
at gm.<anonymous> (C:\Users\brendan\Documents\Code\Web\TheOrm\WWW\v3\node_modules\gm\lib\getters.js:70:16)
at Socket.cb (C:\Users\brendan\Documents\Code\Web\TheOrm\WWW\v3\node_modules\gm\lib\command.js:322:16)
at Socket.g (events.js:291:16)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at onwriteError (_stream_writable.js:340:10)
Imagemagick is installed and seems to work from the command line. i.e. magick -help gives sensible output and you can save the inbuilt test logo image.
I have tried various other gulp libraries including gulp-responsive-images which gives an empty pipe error.
I tried this under the Linux Subsystem for Windows and it works fine - it seems that this is a Windows only problem.
After forking gulp-image-resize and running the test suite I get the following error ...
...
[14:18:20] Starting 'image_resize:interlace_and_resize_imagemagick'...
events.js:160
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at exports._errnoException (util.js:1026:11)
at Socket._writeGeneric (net.js:710:26)
at Socket._write (net.js:729:8)
at doWrite (_stream_writable.js:328:12)
at writeOrBuffer (_stream_writable.js:314:5)
at Socket.Writable.write (_stream_writable.js:241:11)
at Socket.write (net.js:656:40)
at gm._spawn (C:\Users\brendan\Documents\Code\OpenSource\gulp-image-resize\node_modules\gm\lib\command.js:194:18)
at gm._exec (C:\Users\brendan\Documents\Code\OpenSource\gulp-image-resize\node_modules\gm\lib\command.js:167:17)
at gm.proto.(anonymous function) [as size] (C:\Users\brendan\Documents\Code\OpenSource\gulp-image-resize\node_modules\gm\lib\getters.js:68:12)
Unfortunately, the repo had bug reporting disabled - does anyone know how this might be remedied?
Here is my gulpfile.js ...
let gulp = require('gulp');
let imageResize = require('gulp-image-resize');
let path = require('path');
let rename = require('gulp-rename');
let debug = require('gulp-debug');
let INPUT_DIR = './NO_UPLOAD/img_src';
let OUTPUT_DIR = './NO_UPLOAD/img_tmp';
gulp.task('resize:images', function() {
relFns = [
'logo.png',
'image.png',
].map((f) => path.join(INPUT_DIR, f));
return gulp.src(relFns, { base: INPUT_DIR })
.pipe(debug({ title: 'resized' }))
.pipe(imageResize({
width: 100
}))
.pipe(rename((path) => { path.basename += '.sml' }))
.pipe(gulp.dest(OUTPUT_DIR));
});
There were a number of issues ...
Make sure Graphicsmagick is installed as well (may not be necessary but did not do any harm to install)
make sure both gm and magick are in your path
After referring to a comment on this post, I found restarting the computer fixed the issue. (I was surprised at the restart since opening up a new console usually works.)
Finally make sure that you don't run from a console opened from Visual Studio Code instance. VSCode is a 32bit app and launches a 32bit console which does not run 64bit versions of Imagemagick. Instead launch the console from Explorer.

Execute git cmd via node.js on windows fails with err

git is installed on windows and works from any directory (it is in System path)
var child_process = require('child_process');
child_process.exec('git --version', function(err, stdout, stderr) {
// stdout is correct - git version 1.7.11.msysgit.1
// but err is not null
// err is [Error: Command failed: ] killed: false, code: 1, signal: null }
}
What can cause this?
I had this issue using Windows 7 with msysgit. Two things seem to solve the issue.
First, verify that your Path system variable includes a path to the Git bin directory, and not the cmd directory:
C:\Program Files (x86)\Git\bin
Next, verify you have a recent version of msysgit. I've verified the issue as solved with version 1.8.4-preview:
https://code.google.com/p/msysgit/downloads/list
Restart your shell and try again.
As a workaround you can pass {env:{PATH:"C:\path to\node"}} as the options argument to process.exec(cmd, opts, callback) as described in docs. I am surprised that the Windows path doesn't carry over but have no explanation why.

Code crashed after upgraded from Meteor Windows 0.5.4 to Meteor 0.6.4.1

I just upgraded my Windows Meteor from 0.5.4 to 0.6.4.1. I am on Windows 7. After upgrade my
working code crashed with the following error messages:
Errors prevented startup:
Exception while bundling application:
TypeError: Cannot read property 'raw' of undefined
at C:\Program Files (x86)\Meteor\packages\meteor\package.js:15:15
at _.extend.add_file (C:\Program Files (x86)\Meteor\app\lib\bundler.js:201:5)
at self.api.add_files (C:\Program Files (x86)\Meteor\app\lib\bundler.js:102:16)
at Array.forEach (native)
at Function..each..forEach (C:\Program Files (x86) \Meteor\lib\node_modules\underscore\underscore.js:78:11)
at self.api.add_files (C:\Program Files (x86)\Meteor\app\lib\bundler.js:101:11)
at Array.forEach (native)
at Function..each..forEach (C:\Program Files (x86) \Meteor\lib\node_modules\underscore\underscore.js:78:11)
at Object.self.api.add_files (C:\Program Files (x86)\Meteor\app\lib\bundler.js:100:9)
at null.on_use_handler (C:\Program Files (x86)\Meteor\packages\underscore\package.js:7:7)
Your application is crashing. Waiting for file change.
As the two stack trace entries for bundler.js don't seem to tally with what I would expect for 0.6.4.1, there is a possibility that the MSI upgrade didn't work properly (MSI uses hashes to determine if text files are up-to-date).
I would suggest that you try:
Uninstalling Meteor from Control Panel -> Add/Remove programs.
Check that you have no files left in program files \Meteor.
Re-install using the 0.6.4.1 installer.
Check the installation works on the todos example (see below)
Try your app.
To check that the install is working sensibly, create one of the example apps and check it runs:
meteor create --example todos
cd todos
meteor
Since 0.5.4 there have been a couple of changes. The big one being variable scoping.
If there is a variable in a file & you want to access that variable from another file you have to scope it globally.
i.e if you have
var x = true;
You have to change it to
x = true;
The same for a function:
function foo() { return "bar"; }
//or
var foo = function() { return "bar;"}
becomes
foo = function() { return "bar"; };
You have to go through your files an alter these.
Alternatively you could move your files to a new /compatibility directory where they wont be variable scoped.

Why won't Firefox trace to flashlog.txt in Ubuntu?

Okay me and my friend are about to tear our hair out trying to configure the Adobe Flex SDK to work properly on our Ubuntu machine. We have installed and configured the SDK to compile ActionScript files but the FlashPlayer Debugger fails to log traces or errors to flashlog.txt when we execute the compiled swf in Firefox.
We have Flash Player Debugger installed into Firefox and a mm.cfg file located in our home directory.
Links to what we've tried:
http://www.arulraj.net/2010/08/flash-player-debugger-in-ubuntu.html
http://www.gregoryprogrammer.com/2012/12/actionscript-3-code-compilation-in-inux/
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fc9.html
http://helpx.adobe.com/flash-player/kb/configure-debugger-version-flash-player.html
Versions of what we're using:
Firefox Browser 18.0.2
Ubuntu OS 12.0.4
Latest Flex SDK
I notice you didn't mention compiling with the -debug flag. Here're the steps I take:
Make sure you're using the debug version of the player (hit flashplayerversion.com to check). This is getting trickier in-browser, especially in 64-bit Linux. Firefox is probably easier than Chrome these days. You can also try the debug content projector (aka standalone player) located here.
Have a ~/mm.cfg file with TraceOutputFileEnable=1. Here's mine:
> cat ~/mm.cfg
ErrorReportingEnable=1
TraceOutputFileEnable=1
Use the trace method somewhere you know it will be executed:
> cat Main.as
package {
import flash.display.Sprite;
public class Main extends Sprite {
public function Main() {
trace("Hello flashlog.txt");
}
}
}
Compile the SWF with the -debug option:
mxmlc -debug Main.as
I'll test with the content projector:
>flashplayerdebugger Main.swf &
>tail ~/.macromedia/Flash_Player/Logs/flashlog.txt
Hello flashlog.txt
Or open a dedicated terminal to follow the log file as it is written:
>tail -f ~/.macromedia/Flash_Player/Logs/flashlog.txt

Resources