I'm working on a new browser extension and I'm using Mozilla's web-ext tool to test it. I couldn't figure out how to run the test browser in dark mode.
So far I have tried this:
web-ext run --verbose --pref extensions.activeThemeID=firefox-compact-dark#mozilla.org
I figured out a way! Apparently, dark mode is an add-on; not a preference.
First step is to create an empty directory to store our Firefox profile.
mkdir ../dark-mode-profile
npx web-ext run -p ../dark-mode-profile --keep-profile-changes
Then enable dark mode and close Firefox (and hit Ctrl-C if necessary). Since we turned on the --keep-profile-changes flag, all the changes we made are now stored in our profile folder.
We can run Firefox with this profile:
npx web-ext run -p ../dark-mode-profile
Related
npx npm run cypress --headless running this code in my project is still opening up a google chrome user, requiring UI to keep it going
no matter what I try, even uninstalling and reinstalling cypress doesn't fix the issue
The correct way is:
cypress run
Actually by default this command is executed in headless mode, that's why it's not necessary to write --headless. And if you want to run it in headed mode, then:
cypress run --headed
Problem
I want to be able to run my tests in terminal, but all my tests fail due to Cypress using Electron as the default browser and I want it to utilize Chrome, but without having to specify it in the command line.
Current Outcome
I know I can use the command npx cypress run --browser chrome to tell Cypress to use Chrome instead. However, it opens the browser AND runs it in command line.
Expected Outcome
Ideally it would only require me to run npx cypress run and this would only run in the command line using Chrome.
Summary
Is there a way to set the default browser to Chrome instead of Electron so I wouldn't need to specify which browser to use?
Is there something to add to the package.json file to set the default browser to Chrome or a line to inject somewhere? I checked the docs and I couldn't really find anything other than the --browser command.
** Cypress Github Open Issue **
Here is the link to the open issue on their github regarding a headless chrome and also to change the default for cypress run
Support chrome headless and change defaults for cypress run
Photo for the debugger
Sorry for the terrible scribbles...I am under an NDA so had to go back and scratch out all the path names for my project as well as my last name.
Cypress 3.8.1+ allows you to pass --headless to cypress run to make Chrome invisible on any operating system by using Chrome headless:
cypress run --headless --browser chrome
Outdated answer below:
There is not currently a way to hide Chrome in run mode on macOS or
Windows.
We'd like to support it, but we'd have to find some kind of workaround
for xvfb not being available. We can't use google-chrome
--headless either because it won't allow us to install the Cypress extension.
The advice below will only work for Linux.
npx cypress run --browser chrome is the correct way to do what
you're trying to do.
If you are on Linux, you can make it run Chrome in a virtual
framebuffer (so it will be hidden from you) by blanking out the
DISPLAY env variable:
DISPLAY= npx cypress run --browser chrome
Technical explanation:
Cypress does not support running in "headless Chrome" - headless Chrome was not around when Cypress was first written
So, when Cypress is running in Chrome in CI, it uses xvfb to create an X virtual framebuffer, then it uses the DISPLAY variable
to tell Chrome to run in the xvfb
However, if you have DISPLAY set (by default, it is set on Linux if you have a display manager), it will use that DISPLAY instead -
this is why it appears even though you're doing cypress run.
Adding DISPLAY= before the command nulls out DISPLAY, which means that Cypress will spawn xvfb and run it inside of there
instead.
This is not about viewport. The viewport is ok. One thing is the viewport size of the screen, width and height, and another is the graphical interface browser (window), that is opened when you run casperjs test.js --engine=slimerjs.
It's ok that the browser opens when I run casperjs test.js --engine=slimerjs, very useful for testing purposes. But when I stopped testing and want to do something bigger I don't want that browser window open 10 times or 100 times.
I've been reading a while and couldn't find any in the documentation, google or here.
If this is possible, throw the command, I will be very grateful for that. Thank you very much.
Had the same requirement. xvfb (virtual frame buffer) does this work easily
Install xvfb with this command.
sudo apt-get install xvfb
Then run it using this prefix.
xvfb-run -a
So run the command like
xvfb-run -a casperjs tests.js --engine=slimerjs
This will run the application in the headless mode.
Yes, it`s possible, you can hidden window with xvfb util. How to do it. Docs
I am using Raspberry pi(s) for workstations in an office setup. I want the users to have access to the intranet and a couple of websites. I have a proxy set up with whitelist that works fine.
I want to boot the RPI and show only a web browser and connect through the proxy. I understand I need a window manager for this.
I have been experimenting with chromium (as it makes it very easy to insert the proxy address as an attribute when opening chromium via command line). The problem is, Chromium is a demanding browser and struggles with JQuery on the RPI.
I am looking for a browser I can run through a proxy, in a window manager from a start up script that won't be slow as hell!
Does this exist? Or am I going down the wrong path for this?
I don't know if this is really what you want but here is one way to boot directly into a web-browser:
1. Make sure you use a Raspberry with the latest version of raspbian installed and updated:
sudo apt-get update
sudo apt-get upgrade
2. If you don't want to use Midori, install the browser you want. I prefer chromium (Light version of Google Chrome) so that's what I will use here. To install chromium run the following command:
sudo apt-get install chromium
3. Configure raspi-config to start in GUI mode:
sudo raspi-config -> Enable boot to desktop/Scratch -> Desktop login as....
4. To start chromium on boot, comment all existing code in the file and add the following last:
sudo nano /etc/xdg/lxsession/LXDE/autostart
#xset s off
#xset -dpms
#xset s noblank
#chromium
On the last line you can also add switches like kiosk mode (--kiosk) after #chromium. Watch this link for more switches:
List of commandline switches
Hope this was any help! Good luck!
I am really enjoying my time with git.
I'm operating on 2 machines with what I thought were pretty similar setups
On my Laptop
When I type "Git help SomeCommand" from the CLI, my laptop launches the html help in my browser and I am free to read up on whatever help element I asked about.
On my Desktop
The CLI responds as if is is going to do the same, but no browser is switched to and no help is launched
What can I do to get my help back on my desktop?
Note: I'm running the bash shell through console2, but this problem appears to affect the default bash shell run via the context menu in explorer just as much.
I just recently had the same problem, browser wouldn't launch.
I'm running Git 1.9.2.msysgit.0 on Windows 8.1. Default browser - Chrome.
None of the solutions above worked for me. But I simply went to the html file in the explorer, and double-clicked it. Windows then asked me what app to use to open it, and I chose chrome.
Now usual git commands work and open the help html files in Chrome.
As mentioned in the msysgit bug report 445:
Git has it's own tool called "git web--browse" that invokes the web-browser.
Set the environment GIT_TRACE to 1 to see what processes are started, and with what
command-lines.
So that can help debugging the issue.
A temporary workaround (which might not be effective in your case) was:
As temporary workaround one can rename all git-<command>.html to git<command>.html in his <Git>\doc\git\html directory.
The git <cmd> --help suggested by Andy seems to have helped though, and must have "reset" something.
You can configure a web browser to be used to open Git's help files independently of the system's default program assigned to open .html files.
To check if it's set and to what value, simply run:
git config web.browser
To set it globally for all repositories, for example to chrome, run:
git config --global web.browser chrome
You can also set it per-repository, in that case run it inside a repository and without the --global parameter:
git config web.browser chrome
It works automatically if the specified browser's executable is in PATH. If it's not, you may set it manually:
git config browser.<name>.path <path-to-browser-executable>
...so for Chrome browser, it may look like the following:
git config browser.chrome.path "c:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
See the documentation for details.
It seems that this bug went away when I upgraded to the latest version of msysgit (1.7.6 from 1.7.3)
I have this problem currently, and the git <cmd> --help technique doesn't fix it.
I have however found that doing
git help -w <cmd>
Will actually open the help file in the browser, so this is a useful workaround.
I had the same problem (browser wouldn't open), then I realized it's probably because our laptops at work are "least privileged access", meaning we're logged into our Windows systems as standard users. But for development work, including the command window I'm doing git commands from, I'm running as a different user who has local admin privileges. So it actually was opening the Chrome browser, just not in my "logged in" desktop session where I could see it.
To work around this, I ran another copy of Chrome as that user (by Shift-Right clicking on Chrome.exe and running it as the same privileged user that my command prompt is running as). Once that instance of Chrome was running on my desktop, I returned to the command prompt and re-ran the "git help " and it properly launched a new tab in that instance of the browser that was running as the same user my command prompt was.
Stab in the dark: I've always done git <cmd> --help. Does that work?
edit: For future reference. This appears to be what fixed the OP's problem. Running git <cmd> --help seemed to have cleared out something so that it works as specified now. If only I knew the how/why of it...
This set up is current, working and the convention.
It's most likely because you are using the default Git that comes with MacOS called Apple Git which is outdated.
run git --version and check against the Git website.
Install Git using brew install git.
To make sure Homebrew installs take precedence over MacOS installs add the usr/local/bin path to your .zshrc or .bash_profile. export PATH=/usr/local/bin:$PATH. (*Btw, you should use this path also for using Python 3 instead of MacOS Python 2.7 and many other applications).
To make sure all of this is activated do source ~/.zshrc or source ~/.bash_profile. Or simply restart Terminal.
Test it. git help -w commit. A browser window will open.