I want to debug Jasmine tests launched by Karma. In my karma.conf.js I have the following:
port: 9090,
urlRoot: '/',
autoWatch: false,
browsers: ['PhantomJS'],
So you can see that I specified PhantomJS as a browser to start. When I run tests in Run mode, PhantomJS is started. However, when I run tests in Debug mode, the Chrome browser is started and tests are actually executed in Chrome, instead of PhantomJS. Besides, I have these confusing log entries from Karma server:
13:42:36.239:INFO [launcher]: Starting browser PhantomJS
13:42:37.987:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#MpnkVSEn2B33WWVTAAAA with id 88994634
Here is my configuration:
Chrome is started as it's the only browser debugging is supported for. Debugging in PhantomJS is not supported; if you miss it, please vote for WEB-6072
Related
I tried to set up a very bare bones Codeception framework to see what the differences are between it and my enterprise framework for my own learning. My POC framework was running great until I tried to get it with docker and I don't know much about docker. I kept getting this error when trying to run with any docker command:
[ConnectionException] Can't connect to WebDriver at http://chrome:9515/wd/hub. Make sure that ChromeDriver, GeckoDriver or Selenium Server is running.
So I ripped out docker-compose.yml completely and tried to run tests the normal way:
./chromedriver --url-base=/wd/hub
and then in another tab
./vendor/bin/codecept run -vvv
But now I get the error from before! "[ConnectionException] Can't connect to WebDriver at http://chrome:9515/wd/hub. Make sure that ChromeDriver, GeckoDriver or Selenium Server is running. "
At this point, I would just be happy to get my framework back to running without docker. I have tried googling and other SO answers and they don't seem to help, I don't have anything weird in my bash or zsh profile. My other terminal says "ChromeDriver was started successfully." I shouldn't have a firewall. It was working before.
My acceptance.suite.yml is:
actor: AcceptanceTester
modules:
enabled:
- WebDriver:
url: http://localhost
window_size: false # disabled in ChromeDriver
port: 9515
browser: chrome
host: chrome
capabilities:
"goog:chromeOptions": # additional chrome options
- \Helper\Acceptance
I have a suite of Nightwatch tests that I regularly run across multiple browsers on Windows 10
Recently selenium has been unable to locate any elements when running Firefox through a local instance of Jenkins that is run as a Windows service. Firefox uses geckodriver webdriver in Nightwatch.
Test run flawlessly when run locally via cmd or git bash etc.
Anyone have any idea what may be causing this issue.
Versions installed:
Geckodriver v.0.19.1
Firefox v.57.0.4
Nightwatch v0.9.19
Selenium-server-standalone-3.8.1
Failure trace snippet
Starting selenium server... started - PID: 3804
[Widgets\ C36310 Widgets Available On Dispatch] Test Suite
==============================================================
Running: C36310 Widgets Available On Dispatch
√ Details & Strings Loaded
√ Home Page Element Selectors Loaded
× Check For Visibility Of Sign In Banner. - expected "visible" but got:
"not visible"
at Object.exports.command (C:\Users\matthewf\Documents\master-ui\workspace\Workspaces\master_eld\src\resources\custom_commands\login.js:22:6)
I've selenium script which launches chrome browser, goes to a website and does basic checks.
When I tried running same script locally through jenkins I got error
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.13.0-17-generic x86_64)
This is resolved by Unknown error: Chrome failed to start: exited abnormally
I'm confused why Jenkins can't launch real chrome browser on Ubuntu ?
Because Jenkins server normally does not have a graphical subsystem installed in the operating system. When a real browser (or any app) tries to create a window that fails.
You will need to run your tests on Jenkins using a headless browser - one that does not need a graphical subsystem. Chrome-headless is currently the preferred option, replacing the now abandoned PhantomJS.
When running tests, I would like not to be bothered by Chrome popping-up every time Behat launches a scenario needing Chrome.
I know there is a maximizeWindow() method for session objects, but nothing like "minimize".
Nowadays, you can set Chrome to run in headless mode like so (behat.yml):
default:
extensions:
Behat\MinkExtension:
javascript_session: browser
sessions:
browser:
selenium2:
browser: chrome
capabilities:
chrome:
switches:
- "--headless"
You could run Chrome with a virtual framebuffer, so that the window appears on a virtual screen instead of your real screen.
This also allows to easily run your tests on a headless machine, such as a build server.
On Linux, we're using xvfb for this particular purpose. More info: How To Run Your Tests Headlessly with Xvfb
For Windows, see Is there anything like xvfb or xnest for Windows?
Seems there is no method for launching in background. maximizeWindow is for setting the resolution.
You should try to run in a virtual machine or on another PC in order to avoid this kind of issues, popups and interacting by mistake with the window that runs automation.
Running on the same machine should be done when writing new tests and when debugging.
I found an acceptable solution for this that didn't require me to run Chrome headless or in a virtual machine.
Simply log in with a secondary user account on your local machine, and run selenium on that account. Then, switch back to your main user account and run your tests. The chrome browser will be created under the user running selenium and you will never see the chrome windows pop up.
I have set up protractor on my machine by installing protractor globally via npm. Then I have updated my webdriver manager and started it.
Now running protractor protractor-e2e.conf.js works as it should when I have
capabilities: {
'browserName': 'firefox'
},
but for
capabilities: {
'browserName': 'chrome'
},
I get just a popup telling me:
An administrator has installed Google Chrome on this system, and it is available for all users. The system-level Google Chrome will replace your user-level installation now.
How can I resolve this? Should I reinstall Google Chrome? I really would like to test Chrome rather then Firefox...
I have uninstalled chrome, deleted both directories in
c:\Users\user_name\AppData\Local\Google\Chrome\
c:\Program Files (x86)\Google\Chrome\
And it works nicely now.