Adjust protractor config to debug in non-headless mode - selenium

When executing the protractor test, it succeeds in --headless mode, but when I remove the --headless option, it fails stating: the user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir.
As you can see, I'm not using that particular argument, so I'm not what to do about this.
Update: When the crome browser tab opens, data:, is in the address bar.
Error
$ protractor conf.js
[14:10:17] I/launcher - Running 1 instances of WebDriver
[14:10:17] I/direct - Using ChromeDriver directly...
[14:10:18] E/launcher - invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
(Driver info: chromedriver=79.0.3945.16 (93fcc21110c10dbbd49bbff8f472335360e31d05-refs/branch-heads/3945#{#262}),platform=Windows NT 10.0.17763 x86_64)
[14:10:18] E/launcher - WebDriverError: invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
(Driver info: chromedriver=79.0.3945.16 (93fcc21110c10dbbd49bbff8f472335360e31d05-refs/branch-heads/3945#{#262}),platform=Windows NT 10.0.17763 x86_64)
at Object.checkLegacyResponse (C:\Install\node-v12.13.1-win-x64\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (C:\Install\node-v12.13.1-win-x64\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:509:13)
at C:\Install\node-v12.13.1-win-x64\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:441:30
at processTicksAndRejections (internal/process/task_queues.js:93:5)
From: Task: WebDriver.createSession()
at Function.createSession (C:\Install\node-v12.13.1-win-x64\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
at Function.createSession (C:\Install\node-v12.13.1-win-x64\node_modules\protractor\node_modules\selenium-webdriver\chrome.js:761:15)
at Direct.getNewDriver (C:\Install\node-v12.13.1-win-x64\node_modules\protractor\built\driverProviders\direct.js:77:33)
at Runner.createBrowser (C:\Install\node-v12.13.1-win-x64\node_modules\protractor\built\runner.js:195:43)
at C:\Install\node-v12.13.1-win-x64\node_modules\protractor\built\runner.js:339:29
at _fulfilled (C:\Install\node-v12.13.1-win-x64\node_modules\protractor\node_modules\q\q.js:834:54)
at C:\Install\node-v12.13.1-win-x64\node_modules\protractor\node_modules\q\q.js:863:30
at Promise.promise.promiseDispatch (C:\Install\node-v12.13.1-win-x64\node_modules\protractor\node_modules\q\q.js:796:13)
at C:\Install\node-v12.13.1-win-x64\node_modules\protractor\node_modules\q\q.js:556:49
at runSingle (C:\Install\node-v12.13.1-win-x64\node_modules\protractor\node_modules\q\q.js:137:13)
[14:10:18] E/launcher - Process exited with error code 199
Config
exports.config = {
chromeOnly: true,
directConnect: true,
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--no-sandbox', "--headless", "--disable-gpu", "--window-size=800,600"]
},
},
specs: ['login.jenkins.js']
};

The reason for this error is that there are multiple chrome browser instances running on different profiles. When protractor starts your tests, chrome creates a default profile and runs your tests on that profile. If there are multiple chrome instances running, chrome will ask for your user defined profile in the --user-data-dir argument.
This means that you should make sure that there are no pending processes of chrome running before you start your tests. Check for running processes and remove those processes. Then make sure you add an onComplete section like below in your configuration file so that your chrome browser instance is closed after your tests are done. Here is the code snippet.
onComplete: async () => {
await browser.driver.close();
await browser.driver.quit();
}
Try it out once! Might solve the problem you are facing.

Related

This version of ChromeDriver has not been tested with Chrome version 79 error running protractorE2E tests with ChromeDriver Chrome Selenium

Those are my settings:
.gitlab-ci.yml
image: node
stages:
- test
tests:
stage: test
before_script:
# Add Google Chrome to aptitude's (package manager) sources
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee -a /etc/apt/sources.list
# Fetch Chrome's PGP keys for secure installation
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
# Update aptitude's package sources
- apt-get -qq update -y
# Install latest Chrome stable, Xvfb packages
- apt-get -qq install -y google-chrome-stable xvfb gtk2-engines-pixbuf xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable imagemagick x11-apps default-jre
# Launch Xvfb
- Xvfb :0 -ac -screen 0 1024x768x24 &
# Export display for Chrome
- export DISPLAY=:99
# Install AngularJS CLI exclusively
# Add --unsafe-perm to resolve problems with node-gyp infinite loop on Docker
- npm install --silent --unsafe-perm -g #angular/cli#1.1.2
script:
- npm i --quiet
- npm run wd-update
- npm run wd-start &
- npm run start -- js-files/psh.conf.js
- npm run wd-shutdown
only:
- master
- merge_request
And this is the job outoput for tests
Running with gitlab-runner 12.3.0 (a8a019e0)
on runner-gitlab-runner-554cdd7fbc-4t8mw zxqBkdf4
Using Kubernetes namespace: gitlab-managed-apps
Using Kubernetes executor with image node ...
Waiting for pod gitlab-managed-apps/runner-zxqbkdf4-project-62-concurrent-15jnmx to be running, status is Pending
Running on runner-zxqbkdf4-project-62-concurrent-15jnmx via runner-
$ npm i --quiet
> canvas#2.6.0 install /builds/automation/bender/node_modules/canvas
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
[canvas] Success: "/builds/automation/bender/node_modules/canvas/build/Release/canvas.node" is installed via remote
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 457 packages from 433 contributors and audited 1390 packages in 15.657s
found 0 vulnerabilities
$ npm run wd-update
> bender#1.0.0 wd-update /builds/automation/bender
> webdriver-manager update
[15:03:41] I/file_manager - creating folder /builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium
[15:03:41] I/config_source - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/standalone-response.xml https://selenium-release.storage.googleapis.com/
[15:03:41] I/config_source - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/chrome-response.xml https://chromedriver.storage.googleapis.com/
[15:03:41] I/config_source - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/gecko-response.json https://api.github.com/repos/mozilla/geckodriver/releases
[15:03:42] I/downloader - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105.zip https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_linux64.zip
[15:03:42] I/downloader - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
[15:03:42] I/update - chromedriver: unzipping chromedriver_78.0.3904.105.zip
[15:03:42] I/update - chromedriver: setting permissions to 0755 for /builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105
[15:03:42] I/downloader - curl -o/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.26.0.tar.gz https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
[15:03:43] I/update - geckodriver: unzipping geckodriver-v0.26.0.tar.gz
[15:03:43] I/update - geckodriver: setting permissions to 0755 for /builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.26.0
$ npm run wd-start &
$ npm run start -- js-files/psh.conf.js
> bender#1.0.0 wd-start /builds/automation/bender
> webdriver-manager start
> bender#1.0.0 prestart /builds/automation/bender
> tsc && ts-cleaner -d js-files
[15:03:44] I/start - java -Djava.security.egd=file:///dev/./urandom -Dwebdriver.gecko.driver=/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.26.0 -Dwebdriver.chrome.driver=/builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_78.0.3904.105 -jar /builds/automation/bender/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar -port 4444
[15:03:44] I/start - seleniumProcess.pid: 15684
15:03:45.253 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
15:03:45.506 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2019-12-17 15:03:45.713:INFO::main: Logging initialized #1029ms to org.seleniumhq.jetty9.util.log.StdErrLog
15:03:46.441 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
15:03:46.780 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
> bender#1.0.0 start /builds/automation/bender
> node src/flake "js-files/psh.conf.js"
[15:03:52] I/launcher - Running 1 instances of WebDriver
[15:03:52] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
15:03:52.446 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "chrome",
"chromeOptions": {
"args": [
"--headless",
"--no-sandbox",
"--window-size=1550,768"
]
},
"count": 1,
"maxInstances": 1,
"shardTestFiles": false
}
15:03:52.449 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904#{#800}) on port 3722
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1576595032.499][SEVERE]: bind() failed: Cannot assign requested address (99)
[1576595033.109][WARNING]: This version of ChromeDriver has not been tested with Chrome version 79.
15:03:53.266 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
15:03:53.323 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 26b7b655c1318cbcde9cfb69871f56ad (org.openqa.selenium.chrome.ChromeDriverService)
(node:15719) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Started
Jasmine started
2019-12-17T15:03:53.447Z - info: Current test running:
Psh site validations Site language should change
(node:15719) UnhandledPromiseRejectionWarning: WebDriverError: invalid session id
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'runner-zxqbkdf4-project-62-concurrent-15jnmx', ip: '10.36.0.39', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.138+', java.version: '1.8.0_232'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:509:13)
at /builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:441:30
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:15719) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15719) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:15719) UnhandledPromiseRejectionWarning: WebDriverError: invalid session id
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'runner-zxqbkdf4-project-62-concurrent-15jnmx', ip: '10.36.0.39', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.138+', java.version: '1.8.0_232'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:509:13)
at /builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:441:30
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:15719) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:15719) UnhandledPromiseRejectionWarning: WebDriverError: invalid session id
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'runner-zxqbkdf4-project-62-concurrent-15jnmx', ip: '10.36.0.39', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.138+', java.version: '1.8.0_232'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:509:13)
at /builds/automation/bender/node_modules/selenium-webdriver/lib/http.js:441:30
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:15719) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
So, the error that I having is:
UnhandledPromiseRejectionWarning: WebDriverError: invalid session id
Any idea about this?
I was researching about two days at least and I didn't found anything related, I see a lot of errors but no one like this.
Should I use a docker image? instead install everything on the fly?
I couldn't find a docker image that match with my necessity.
Is the seleniumaddress that I'm using correct?
It's the one recommended by protractor site: seleniumAddress: 'http://localhost:4444/wd/hub'
This error message...
Starting ChromeDriver 78.0.3904.70
.
[1576595033.109][WARNING]: This version of ChromeDriver has not been tested with Chrome version 79.
.
15:03:53.323 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session 26b7b655c1318cbcde9cfb69871f56ad (org.openqa.selenium.chrome.ChromeDriverService)
(node:15719) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=78.0
Release Notes of chromedriver=78.0 clearly mentions the following :
Supports Chrome version 78
You are using chrome= 79.0
Release Notes of ChromeDriver v79.0 clearly mentions the following :
Supports Chrome version 79
So there is a clear mismatch between the ChromeDriver v78.0 and the Chrome Browser v79.0
Solution
Ensure that:
ChromeDriver is updated to current ChromeDriver v79.0 level.
Chrome is updated to current Chrome Version 79.0 level. (as per ChromeDriver v79.0 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Reference
You can find a relevant detailed discussion in:
How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium
If you are using npm implementation of protractor type below command in cmd . Today by chrome version was changed to 79 and doing this solved my issue .
webdriver-manager update

session not created: Chrome version must be between 71 and 75 [duplicate]

After update of chromedriver to version 2.46 my tasts fail to initialize.
I got message like this:
Starting ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1) on port 44269
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Failed to invoke configuration method com.personal.CustomTest.initTests not created: Chrome version must be between 71 and 75
(Driver info: chromedriver=2.46.628402,platform=Windows NT 10.0.16299 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.58 seconds
Build info: version: '2.53.1'
It is clearly saying that my browser version is not valid. But I am using Chrome 72.0.3626.119 so it is between 71 and 75.
Selenium version is 2.53.1.
And I am running test through console command with the help of testNG.
Any idea? Every ideas that I found was about changing selenium version but I cant do it.
For me to resolve this problem :
On Windows
cd C:\Users\[myname]\AppData\Roaming\npm\node_modules\protractor
npm i webdriver-manager#latest
webdriver-manager update
webdriver-manager start &
On Cent-OS (I used Cent-OS 7.4.* and it worked fine.)
cd /usr/lib/node_modules/protractor/
sudo npm i webdriver-manager#latest
sudo webdriver-manager update
sudo webdriver-manager start &
I hope this helps you in any way.
This error message...
Starting ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1) on port 44269
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Failed to invoke configuration method com.personal.CustomTest.initTests not created: Chrome version must be between 71 and 75
...implies that the ChromeDriver v2.46 is not compatible with the Chrome Browser version which is being accessed by your program/webdriver.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.46
Release Notes of chromedriver=2.46 clearly mentions the following :
Supports Chrome v71-73
Though you mentioned you are using Chrome 72.0.3626.119 possibly there are multiple instances of Chrome Browser installed within your system and your program by default is accessing the Chrome Browser whose version is not between v71.x and v75.x
You are using chrome=67.0
Release Notes of ChromeDriver v2.38 clearly mentions the following :
Supports Chrome v65-67
Solution
Keep JDK upgraded to recent levels JDK 8u201.
Uninstall all the instances of Chrome Browser (you can opt to use Revo Uninstaller).
Upgrade ChromeDriver to current ChromeDriver v2.46 level.
Keep Chrome version between Chrome v71-73 levels. (as per ChromeDriver v2.46 release notes)
For me, I had to update my chrome driver in my project to match the version of Chrome on my local machine.
yarn add chromedriver#76.0.0 -D
https://www.npmjs.com/package/chromedriver
In my case I was getting the same error after my chrome was updated to version 76. Which was happening when chimp tries to use chromedriver to execute the selenium test.
DevTools listening on ws://127.0.0.1:49220/devtools/browser/e88586cb-ed67-44fc-a742-43b767e2b8f9
[chimp][helper] setupBrowserAndDDP had error
{ Error: session not created: Chrome version must be between 71 and 75
at Object.wait (C:\ACPMS\ELS_AT\node_modules\fibers\future.js:449:15)
at Object.<anonymous> (C:\ACPMS\ELS_AT\node_modules\wdio-sync\build\index.js:344:27)
at Object.<anonymous> (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\session-manager.js:145:21)
at initBrowser (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\chimp-helper.js:189:43)
at Object.setupBrowserAndDDP (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\chimp-helper.js:264:7)
at Context.<anonymous> (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\mocha\mocha-helper.js:13:15)
at C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\utils\fiberize.js:29:22
(Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17134 x86_64)
at new RuntimeError (C:\ACPMS\ELS_AT\node_modules\webdriverio\build\lib\utils\ErrorHandler.js:143:12)
at Request._callback (C:\ACPMS\ELS_AT\node_modules\webdriverio\build\lib\utils\RequestHandler.js:318:39)
at Request.self.callback (C:\ACPMS\ELS_AT\node_modules\request\request.js:185:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (C:\ACPMS\ELS_AT\node_modules\request\request.js:1161:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous>
For me it didn't work when I updated the chrome driver by npm (both globally and locally) and then I followed these steps to resolve the issue, which might give some idea on where to check in this kind a issue:
Because exception was thrown in node_modules\chimp\dist\lib\utils\fiberize.js i navigated to that file and found one level above this file node_modules\chimp\dist\lib\chromedriver.js which has the code to start chromedriver.
I added a console.log to chromedriverPath which can be seen below and re-executed the tests to get the chromedriver path in console logs.
Chromedriver.prototype.start = function(callback) {
var self = this;
var port = self.options.port;
if (this.child) {
callback();
return;
}
var chromedriverPath = chromedriver.path;
//this was added my me the see that chrome drive path
console.log("[chimp] " + chromedriverPath);
if (fs.existsSync(chromedriverPath)) {
this.child = processHelper.start(
{
bin: chromedriverPath,
prefix: "chromedriver",
args: ["--port=" + port, "--url-base=wd/hub"],
waitForMessage: /Starting ChromeDriver/,
errorMessage: /Error/
},
callback
);
} else {
callback("[chimp][chromedriver] Chromedriver executable not found.");
}
};
When i got the path of the chromedriver which is used to execute the tests, i just navigated to that folder and replaced chromedriver executable with the most recent version.
I hope this helps.
Try this: Download the compatible ChromeDriver.exe file for the updated version of Chrome browser and replace it. It works for me.

selenium-side-runner is failing for Chrome, ran through fine with Firefox

I'm trying out the command line runner of Selenium IDE selenium-side-runner on a .side file.
I can open this .side file in Selenium IDE and run the test suite, it can execute just fine, but when running the command line runner i get this error.
myuser#mycomputer [10:02:36] $ selenium-side-runner --debug selenium/seleniumtesting.side
debug: Could not load /Users/myuser/projects/selenium/.side.yml
debug: { capabilities: { browserName: 'chrome' },
params: {},
runId: 'a508a80619537b4ac9c18368857f84f2',
path: '/usr/local/lib/node_modules/',
server: undefined,
timeout: 15000,
baseUrl: undefined }
info: Running selenium/seleniumtesting.side
debug: jest worker args
debug: 0=--no-watchman, 1=--testMatch, 2={**/***/*.test.js,**/***.test.js}
debug: jest work opts
debug: cwd=/Users/myuser/projects/selenium/side-suite-seleniumtesting, stdio=inherit
FAIL ./BasicFullCheckoutflow.test.js (6.314s)
Basic Full Checkout flow
✕ 2. Add product to the cart (3035ms)
✓ 3. Checkout (1530ms)
● Basic Full Checkout flow › 2. Add product to the cart
StaleElementReferenceError: stale element reference: element is not attached to the page document
(Session info: chrome=73.0.3683.103)
(Driver info: chromedriver=2.46.628411 (3324f4c8be9ff2f70a05a30ebc72ffb013e1a71e),platform=Mac OS X 10.14.3 x86_64)
at Object.checkLegacyResponse (../../../../../../usr/local/lib/node_modules/selenium-side-runner/node_modules/selenium-webdriver/lib/error.js:585:15)
at parseHttpResponse (../../../../../../usr/local/lib/node_modules/selenium-side-runner/node_modules/selenium-webdriver/lib/http.js:533:13)
at Executor.execute (../../../../../../usr/local/lib/node_modules/selenium-side-runner/node_modules/selenium-webdriver/lib/http.js:468:26)
UPDATE: This is only happening for chrome webdriver, when i run with firefox it went through fine
selenium-side-runner -c "browserName=firefox" selenium/seleniumtesting.side
Try in headless mode with below options:-
selenium-side-runner -c "browserName=chrome chromeOptions.args=[headless,no-sandbox,disable-dev-shm-usage]" selenium/seleniumtesting.side

WebDriverException: Message: chrome not reachable

I use Selenium Python,
when I run my crawler I got this error
WebDriverException: Message: chrome not reachable
(Driver info: chromedriver=2.9.248304,platform=Linux 3.16.0-4-amd64 x86_64)
I read this question
I downloaded chromedriver (binary) and I copy/paste it to /usr/bin
I tried by
driver = webdriver.Chrome('/usr/bin/chromedriver')
but I have the same error
In your protractor.configuration file, if you have the following:
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'binary': 'path/to/chromedriver.exe';
} },
Then please remove that binary and instead point to the chromdriver like this:
//protractor.conf.js
chromeDriver: "C:/path/to/chromedriver.exe",
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
}
},
Notice how I removed the 'binary' argument from the capabilities and added the "chromedriver:" attribute.
That worked for me in removing that annoying error that says "
UnknownError: chrome not reachable
28-Jul-2016 10:16:57
(Driver info: chromedriver=2.19.346078 (6f1f0cde889532d48ce8242342d0b84f94b114a1),
platform=Windows NT 10.0 x86_64)
(WARNING: The server did not provide any stacktrace information)
Lastly makes sure you update both chromedriver and seleniumServer like this:
webdriver-manager update
OR
Run this command below to update to a SPECIFIC chromedriver version i.e v2.24 as of 10/04/2016:
webdriver-manager update --versions.chrome 2.24
if it says that the command is not recognized, then add it to your PATH in windows environment variable. The webdriver-manager generally sits in the Protractor folder which you can get with npm install protractor

Protractor redirects and times out immediately after loading page

I'm trying to write some e2e specs for an AngularJS application. I have one Jasmine spec in test/e2e/test_spec.js:
describe('basic functionality', function() {
it('loads the home page', function() {
browser.get('/');
expect(browser.getCurrentUrl()).toMatch(/localhost/);
});
});
Terminal output when the spec is run:
> protractor protractor.config.js
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
basic functionality
loads the home page - fail
Failures:
1) basic functionality loads the home page
Message:
Error: waiting for page to load for 10000ms
Wait timed out after 10013ms
Stacktrace:
Error: waiting for page to load for 10000ms
Wait timed out after 10013ms
at Array.forEach (native)
From: Task: waiting for page to load for 10000ms
at [object Object].<anonymous> (/Users/jdent/swamp-bunny/test/e2e/test_spec.js:3:13)
From: Task: Asynchronous test function: it()
Error
at [object Object].<anonymous> (/Users/jdent/swamp-bunny/test/e2e/test_spec.js:2:3)
at Object.<anonymous> (/Users/jdent/swamp-bunny/test/e2e/test_spec.js:1:63)
Finished in 10.955 seconds
1 test, 1 assertion, 1 failure
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1
While the console is sitting on [launcher] Running 1 instances of WebDriver, Chrome opens and displays the index page for a fraction of a second, then changes to a blank page with data:text/html,<html></html> in the address bar.
Here is my protractor.config.js:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'chrome'
},
specs: 'test/e2e/**/*_spec.js',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
isVerbose: true
},
allScriptsTimeout: 20000,
onPrepare: function() {
return browser.driver.get("http://localhost:8100");
}
};
My webdriver-manager stuff seems to be up to date, although the tool doesn't seem to have a way to output version numbers.
> webdriver-manager status
selenium standalone is up to date
chromedriver is up to date
IEDriver is not present
Why is the spec failing?
Edit: This is what is printed to the terminal when onPrepare is commented out:
> protractor protractor.config.js
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
The last active task was:
unknown
basic functionality
loads the home page - fail
Failures:
1) basic functionality loads the home page
Message:
timeout: timed out after 30000 msec waiting for spec to complete
Stacktrace:
undefined
Finished in 34.27 seconds
1 test, 1 assertion, 1 failure
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1
Edit 2: When I do browser.get("http://google.com"), Chrome briefly shows the data: and data:text/html,<html></html> pages, redirects to Google, then times out looking for Angular.
> protractor protractor.config.js
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
basic functionality
loads the home page - fail
Failures:
1) basic functionality loads the home page
Message:
Error: Angular could not be found on the page http://google.com/ : retries looking for angular exceeded
Stacktrace:
Error: Angular could not be found on the page http://google.com/ : retries looking for angular exceeded
at Array.forEach (native)
From: Task: Asynchronous test function: it()
Error
at [object Object].<anonymous> (/Users/jdent/swamp-bunny/test/e2e/test_spec.js:2:3)
at Object.<anonymous> (/Users/jdent/swamp-bunny/test/e2e/test_spec.js:1:63)
Finished in 12.186 seconds
1 test, 1 assertion, 1 failure
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1
Set baseUrl: 'http://localhost:8100' in your protractor.config.js file. From the Protractor Reference Config:
A base URL for your application under test. Calls to protractor.get() with relative paths will be prepended with this.
It is a sporadic open bug in protractor https://github.com/angular/protractor/issues/5103
Instead of this
browser.get('http://juliemr.github.io/protractor-demo/');
Using this has solved my issue.
browser.driver.get('http://juliemr.github.io/protractor-demo/');
I had that problem in chrome. I read somewhere that protractor starts on that data:text/html,<html></html> page. Calling browser.get(...) navigates away from that page. My idea was to open chrome already on my base url. I accomplished that by adding it to the capabilities like this:
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['--app=www.yourBaseUrl.com']
}
},
It's a bit of a hack, but it seems to have done the trick.