Cannot open Firefox in Windows Subsystem For Linux - firefox

Firefox version: 77.0.1
X Server: Vc X Server (VcXsrv)
Ubuntu: 18.04 LTS
When I attempt to launch Firefox, I get the following message:
"Firefox has just been updated in the background. Click Restart Firefox to complete the update."
Doing so does not fix it.
What I have tried:
Opening about:config and setting browser.tabs.config.autostart and browser.tabs.config.autostart2 to false
Opening about:support page and click on Refresh Firefox (this starts up firefox again, but the URL bar no longer works as well, so I cannot do about:config or about:support anymore)
Updating and upgrading all packages with apt
Here are the first few errors I see when I attempt to start it up:
[Parent 11057, Gecko_IOThread] WARNING: FileDescriptorSet destroyed with unconsumed descriptors: file /build/firefox-Wud6wF/firefox-77.0.1+build1/ipc/chromium/src/chrome/common/file_descriptor_set_posix.cc, line 19
Exiting due to channel error.
###!!! [Parent][MessageChannel] Error: (msgtype=0x2000A0,name=PBrowser::Msg_SafeAreaInsetsChanged) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x200096,name=PBrowser::Msg_LoadRemoteScript) Channel error: cannot send/recv
There are many more after, but follow a similar format to those second two.
Am I just missing a package? Or is FF fundamentally just not compatible with WSL?

Related

OSX fix Selenium Chromedriver launch error spawn Unknown system error -86 Bad CPU type in executable?

Suddenly on the afternoon of January 6, 2021, my Selenium Protractor tests under OSX stopped working with the mysterious error
spawn Unknown system error -86
I did some research and discovered that error number 86 is the same as
Bad CPU type in executable
and ran the following to compare the cpu architecture of my chromedriver binary to my system:
% file chromedriver_87.0.4280.88
chromedriver_87.0.4280.88: Mach-O 64-bit executable arm64
% uname -a
Darwin kobl179273m 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
% uname -p
i386
How can I fix the chromedriver binary used by my Selenium so that it will run on my Intel x64 mac and clear the "system error -86" or "Bad CPU type" message?
The issue is described in https://github.com/angular/webdriver-manager/issues/476.
This has been now fixed in 12.1.8 so just update to that webdriver manager.
For most users this can be accomplished with
npm uninstall protractor && npm install protractor
Edit: this answer should be considered deprecated now that the underlying bug in webdriver-manager has been fixed. A better solution would be to upgrade to the newest version of webdriver-manager. The answer below may be useful if people need to use an older version of webdriver-manager which still has the bug.
As per Deepak Srinivasan's comment above, this error is caused by https://github.com/angular/webdriver-manager/issues/476
Root Cause:
The ChromeDriver team added "_m1" to the end of the filename for their Apple Silicon ARM builds of Chromedriver -- but both the Silicon and Intel versions of chromedriver have "mac64" in the filename, and the version number is exactly the same. This causes webdriver-manager to always download the Silicon build of Chromedriver, even on Intel macs. As a general solution, simply avoid using the chromedriver that has _m1 in its filename if you are on an Intel mac.
Solution 1: Downgrade to Chrome 86.0.4240.198 and Chromedriver 86.0.4240.22. These versions work together and are the most recent versions prior to the new and problematic support for Silicon ARM
Chrome 86 download page:
https://google-chrome.en.uptodown.com/mac/download/2920124
Disable auto-updates in Chrome: https://superuser.com/questions/1359017/how-do-i-disable-automatic-updates-of-google-chrome-on-mac-os-x
Chromedriver 86: https://chromedriver.storage.googleapis.com/index.html?path=86.0.4240.22/
% webdriver-manager update --versions.chrome=86.0.4240.22
Solution 2: Modify the webdriver-manager npm package to point to the correct chromedriver (thanks to ciekaway from the angular github issue page for this fix)
Modify the following file
node_modules/webdriver-manager/built/lib/files/file_manager.js
or, if using protractor
node_modules/protractor/node_modules/webdriver-manager/built/lib/files/file_manager.js
Near the top of the downloadFile method around line 166, add the following line to remove "_m1" from the name of the file:
fileUrl.url = fileUrl.url.replace(/_m1/, '');
It needs to be after the beginning of the .then block that starts with
binary.getUrl(binary.version()).then(fileUrl => {
it also needs to be before the next reference to fileUrl.
For example:
binary.getUrl(binary.version()).then(fileUrl => {
binary.versionCustom = fileUrl.version;
fileUrl.url = fileUrl.url.replace(/_m1/, '');
let filePath = path.resolve(outputDir, binary.filename());
Note that this solution is temporary. It will be overwritten by an npm install. The Chromedriver and/or the webdriver-manager team will probably fix this issue, at which point you should clear the modified version of your webdriver-manager and download the fix from npm.
For macOS Catalina Version 10.15.6 (19G73)
In my case I was working with Rails and Capybara for feature tests. What worked for me was
First, find the actual chromedriver location running:
which chromedriver
# Which returned:
/Users/alex/.webdrivers/chromedriver
Then, install chromedriver via Homebrew:
brew install chromedriver
Then, remove old chromedriver reference found at previous location with:
rm /Users/alex/.webdrivers/chromedriver
Now, link the old chromedriver reference to the one installed with brew:
ln -s /usr/local/bin/chromedriver /Users/alex/.webdrivers/chromedriver
Then, open Finder app, then click on Go menu and then click Go to folder ... option, and enter this route:
/usr/local/Caskroom/chromedriver/
There you should see a folder with the chromedriver version you have installed, something like this:
88.0.4324.96
Enter that folder and you should see the chromedriver binary file.
Right click on it, and click on Open
Now, you should get a terminal window popping up with the output:
Last login: Sun Jan 31 12:29:15 on ttys001
/usr/local/Caskroom/chromedriver/88.0.4324.96/chromedriver ; exit;
  ~  /usr/local/Caskroom/chromedriver/88.0.4324.96/chromedriver ; exit;
Starting ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b- refs/branch-heads/4324#{#1784}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Finally, press Ctrl+C to stop the execution and quit the terminal window.
Now, you should be able to run capybara tests.
npm uninstall protractor && npm install protractor
If you use webdrivers gem, upgrade it:
bundle update webdrivers

VSCode Unable to locate phpcs on macOS

I know this has been asked many times but I can't find an answer that works for me. I'm on a Mac running macOS 10.15.6 and I'm getting the issue of Unable to locate phpcs in VSCode version 1.47.3. The actual error is:
phpcs: Unable to locate phpcs. Command failed: "/Users/mat/.composer/vendor/bin/phpcs" --version
If I run /Users/mat/.composer/vendor/bin/phpcs --version in my terminal I get the correct response and if I do which phpcs I get the desired /Users/mat/.composer/vendor/bin/phpcs.
When I switch the VSCode extension works as it should but then when I close and reopen VSCode I get the error, which is solved again if I switch extensions.
My VSCode settings are:
"phpcs.enable": true,
"php.validate.executablePath": "/Users/mat/.composer/vendor/bin/phpcs",
"phpcs.executablePath": "/Users/mat/.composer/vendor/bin/phpcs",
"phpcs.standard": "PSR12",
I've really been unable to figure out why this error keeps happening when I launch VSCode. Any help would be greatly appricated.
Thanks

Error: unknown error: DevToolsActivePort file doesn't exist, when executing ruby script with watir

I am fairly new to Centos7 and trying to develop a solution for browser automation in the below environment:
OS: Centos7
Ruby: 2.6
Watir
Browser:Google Chrome 72.0.3626.109
Driver: ChromeDriver 2.46.628388
My script:
require 'watir'
# Initialize the browser with the driver path
site="https://google.com"
browser = Watir::Browser.new :chrome
browser.goto site
Getting error:
`assert_ok': unknown error: Chrome failed to start: exited abnormally (Selenium::WebDriver::Error::UnknownError)
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 3.10.0-957.5.1.el7.x86_64 x86_64)
I found multiple solutions on net that are recommending to modify chrome options like:
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
But I don't know where to set these. The nearest I was able to reach is the answers provided here: How do I pass options to the Selenium Chrome driver using Python?
Can anyone please help me to resolve it in a step-by-step manner?
Also faced similar issue but with npm and protractor configuration but I guess the solution would be similar. You have to install chrome browser in your linux system.
The chromedriver is just a wrapper written to use the chromebrowser for running the test cases.
Also if google-chrome is installed you might want to check the path were it is installed in linux based operating system the path expected is under /usr/bin/google-chrome. This file is generally a link to the actual binary of the chrome.
Hope so this helps

Creating New Shared NativeScript Project doesn't work

When I run the following:
ng new --collection=#nativescript/schematics myProject --shared
It does not work. I have installed the schematic and everything according to the docs but that command does nothing. Any ideas?
I have followed the documentation here:
https://docs.nativescript.org/angular/code-sharing/creating-a-new-project
I checked for an invalid .angular.json but there is not one in my home directory.
I am running angular 6.0.3
There are no errors, I run the command it waits about 5 seconds and just returns doing nothing.
I found that I was running the wrong version of the Angular CLI, but I have upgraded and now when I run the build for iOS I get the following:
Error: Cannot connect to device socket.The error message is Device socket port cannot be found.
at Errors.fail (/Users/jonathan/.nvm/versions/node/v10.8.0/lib/node_modules/nativescript/lib/common/errors.js:125:28)
at Errors.failWithoutHelp (/Users/jonathan/.nvm/versions/node/v10.8.0/lib/node_modules/nativescript/lib/common/errors.js:135:21)
at AppDebugSocketProxyFactory.<anonymous> (/Users/jonathan/.nvm/versions/node/v10.8.0/lib/node_modules/nativescript/lib/device-sockets/ios/app-debug-socket-proxy-factory.js:105:38)
at Generator.throw (<anonymous>)
at rejected (/Users/jonathan/.nvm/versions/node/v10.8.0/lib/node_modules/nativescript/lib/device-sockets/ios/app-debug-socket-proxy-factory.js:5:65)
The Emulator opens and the app gets installed on the emulator but crashes as soon as it starts. I have tried to make this work with just a hello world app and it works correctly. But when using the shared flag it does not work.

How do I install WebExtension that developed by myself to Firefox Nightly?

I already know the way to temporarily install an add-on for debugging.
However, I want to install it persistently. I do not want to upload it to AMO, because I've developed it for use by myself only.
How do I install it on Firefox Nightly?
Browser: Firefox Nightly 56a1
OS: macOS 10.12.5
Edit
I attempted Andrew's way while referring to Getting started with firefox-addon, but an error occurred (This add-on could not be installed because it appears to be corrupt.), despite that temporary installation was successful.
Why did installation fail only when installing it from Install Add-on from File...?
Source code is here
https://github.com/KiYugadgeter/webext
Edit2:
The following is Error message on browser console.
1497764354857 addons.xpi WARN Invalid XPI: Error: Cannot find id for
addon /
Users/username/jsworks/webextensions/stacknotifier/something.xpi (resource://gre/modules/addons/XPIInstall.jsm:1642:17) JS Stack trace: loadManifest#XPIInstall.jsm:1642:17 <
async*init#XPIInstall.jsm:2122:13 < async*createLocalInstall#XPIProvider.jsm:4820:12 < getInstallForFile#XPIProvider.jsm:3437:5 < callProviderAsync#AddonManager.jsm:297:12 <
promiseCallProvider/<#AddonManager.jsm:321:53 < Promise#Promise-backend.js:390:5 <
promiseCallProvider#AddonManager.jsm:320:10 < getInstallForFile/<#AddonManager.jsm:1856:29
< async*getInstallForFile#AddonManager.jsm:1854:13 < getInstallForFile#AddonManager.jsm:
3560:7 < doCommand/<#extensions.js:1472:13
[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIURI.hostPort]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://gre/modules/PopupNotifications.jsm :: PopupNotifications_refreshPanel/< :: line 806" data: no]
Recent versions of Firefox require you to sign the extension before you can permanently install it. To get your extension signed you don't have to publish it. All you need is a tool called web-ext. Then you can simply run this from your terminal:
web-ext sign --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET
Getting started with web-ext:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Getting_started_with_web-ext
web-ext sign:
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/web-ext_command_reference#web-ext_sign
Getting your AMO_JWT_ISSUER and AMO_JWT_SECRET:
https://addons.mozilla.org/en-US/developers/addon/api/key/
In short:
Downlaod and Install NodeJS
Open a new terminal and run npm install --global web-ext
Go to api key site and get your AMO_JWT_ISSUER and AMO_JWT_SECRET
Open a new terminal, go into the folder which contains your extension sources and run
web-ext sign --api-key=xxxx:xxxxxxx:xxx --api-secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Your error is: Invalid XPI: Error: Cannot find id for addon
Quoting WebExtension documentation:
When do you need an Add-on ID?
If you are loading the add-on from it's XPI file, are not loading it temporarily using about:debugging and it is not signed.
...
This is your situation; as such, you need to fill out the applications.gecko.id key in the manifest. This plays the similar role as setting key key in Chrome (in Chrome, the ID of a packed extension is a hash of the key field).
Alternatively (and possibly preferably), you can sign your XPI as indicated by Forivin's answer, because loading unsigned WebExtensions is only possible in Nightly. That would require interaction with AMO - but there's no requirement to host there.
Since you said you're using Nightly, you can also go to about:config, find the preference "xpinstall.signatures.required" and flip it to false. Then you should be able to install your extension from about:addons -> "Install Add-on from File..."

Resources