I face the problem with running protractor tests in headless environment. I know about option with Chrome, which implies setting up like that:
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [ "--headless", "--disable-gpu" ]
}
}
However when using this method, I am obliged to have Chrome installed on my system which isn't option for me because I can't be sure about environment which my tests will be run in. PhantomJS would be great in my case, because everything you need is just install npm package. But PhantomJS in deprecated at the moment and can cause some unexpected bugs.
So my question is: Is there any way to use headless Chrome or some other alternative (like PhantomJS) which won't oblige me to install any browser?
Thank you for your time.
Related
I am running tests in Jenkins and the tests are running on outdated Chrome 71 and I want to update the chrome it is using. I've tried updating my package.json to current TestCafe but it is still running 71. when I run node_modules/.bin/testcafe --version it just lists firefox, chrome. It seems that since the chrome is in node_modules I should be able to update to latest but I haven't found anything online to show how to do so.
Running locally on my machine chrome is v91. I thought doing an 'npm i' locally and pushing that branch would update but it was not successful.
Jenkins output:
npm i
node_modules/.bin/testcafe --version
1.15.0
node_modules/.bin/testcafe -e chrome:headless auth-subscriber-signs-in-validates-homepage.js
Running tests in: Chrome 71.0.3578.98 / Linux 0.0
TestCafe doesn't upgrade or downgrade browsers. It just searches the installed browsers and runs tests in them. You need to inspect the Jenkins job and found the way how browsers are installed for it.
I have a problem with chromium when I run my tests through the puppeteer.
What happens is that my tests require the microphone to be enabled the moment I log in to the application, even after adding:
'--use-fake-ui-for-media-stream', '--no-sandbox', '--disable-setuid-sandbox'] : ['--use-fake-ui-for-media-stream'
Before working normally, after changing the machine it stopped working and I don't know if it is related to the version of the chromium that is started:
This is the version of chromium when testing starts:
Version 77.0.3844.0
And my version of the puppeteer is:
```"puppeteer": "^1.19.0"````
Has anyone ever experienced this? If so, how do I update the chromium?
Thanks,
I'm switching to VSCode WSL Remote mode for a JavaScript project. The Chrome Debugger Extension always look for Google Chrome in Linux. Is this the correct behavior?
I have a Chrome for Linux installed in WSL, which could run on X server. The problem is that the breakpoints are not working.
I've tried removing Chrome in WSL, the extension will then throw Can't find Chrome - install it or set the "runtimeExecutable" field in the launch config.
Should I set "runtimeExecutable" to chrome.exe or force it to run on local side with
"remote.extensionKind": {
"msjsdiag.debugger-for-chrome": "ui",
}
Could I correct some config so that the Chrome Debugger can find the Chrome in Windows if there's no Linux install?
Is there any official guide for it?
Thanks!
Yes, you should set
"remote.extensionKind": {
"msjsdiag.debugger-for-chrome": "ui"}
An alternative would be to set an alias chrome to go to chrome.exe in Windows. To ensure persistence, add it to your ~.bashrc or shell equivalent or alternatively .profile.
Side note: you should be able to debug with the new chromium-based Edge as well if you prefer using that.
I like to run my karma unit tests on a headless chrome. Using karma-chrome-launcher and setting the browser to "ChromeHeadless" works on my machine. But on the CI server it fails with the message "No binary for ChromeHeadless browser on your platform."
Installing chrome on the CI machine is not possible. Is there another way to load the chrome binaries?
for example the google puppeteer module seems to load that when run. from the docs: "Puppeteer downloads and uses a specific version of Chromium". How can i achieve the same?
You can use Puppeteer (headless Chromium), follow these instructions.
If what you fear is that download from the internet might be slow, you can tell puppeteer where to download chrome from and use a local address.
Use PUPPETEER_DOWNLOAD_HOST to specify where to download Chrome from and PUPPETEER_SKIP_CHROMIUM_DOWNLOAD to skip downloading Chrome altogether.
You can read more about this in the documentation.
We are using Intern to test our application. We have three different Intern configuration files which we use to target either a local instance of Selenium, an instance running on a local virtual machine, or Sauce Labs.
Intern runs tests against Firefox on both the local instance and the virtual machine without error. However, when I add Chrome to the list of browsers I would like to be tested against, on both the local and virtual machine instance, I get an error indicating: "The environment you requested was unavailable". I know that the required browser is available in both locations, and in fact I know that this process has worked in the past. What could have changed and what do I need to configure to make Intern and or Selenium see Chrome again?
I'm working on a machine running Windows 7 and the VM I have installed runs up an Ubuntu image, carefully installing Firefox, Chrome and PhantomJS along the way.
When running against a local instance of Selenium we are using the following configurations:
capabilities: {
'selenium-version': '2.39.0'
},
environments: [
{ browserName: 'chrome' },
{ browserName: 'firefox' }
]
When running against Selenium on an Ubuntu VM we are using the following configurations:
capabilities: {
'selenium-version': '2.39.0'
},
environments: [
{ browserName: 'chrome' },
{ browserName: 'firefox' },
{ browserName: 'phantomjs' }
]
Since raising this question I have made some progress with the VM version of the testing. Our setup.sh file which configures the various components added to the VM was referencing an old version of chromedriver:
Old configuration:
wget "https://chromedriver.googlecode.com/files/chromedriver_linux64_2.3.zip"
unzip chromedriver_linux64_2.3.zip
mv chromedriver /usr/local/bin
Became:
wget "http://chromedriver.storage.googleapis.com/2.9/chromedriver_linux64.zip"
unzip chromedriver_linux64.zip
mv chromedriver /usr/local/bin
At the moment I am still unable to make the local version of our tests run Chrome however. The chromedriver is installed as part of Intern as far as I can see and even though I cleared my npm cache and reinstalled, and in fact even when I replaced the automatically included chromedriver with one downloaded manually, it still gives me the "The environment you requested was unavailable" fault.
Back in the VM environment we are trying to use PhantomJS. Intern seems to be able to initialise an instance of Phantom but it then hangs before any tests have been run. Phantom includes its own (ghost)driver and I believe its startup is configured correctly as follows:
echo "Starting Phantomjs ..."
phantomjs --ignore-ssl-errors=true --web-security=false --webdriver=192.168.56.4:4444 &
If anyone has any pointers to making chrome work on my local machine and phantom work on the VM I would be most welcome.