When I run the test, Opera opens, but the test does not run and an error falls into the console
[Facebook\WebDriver\Exception\SessionNotCreatedException] Unable to create session from {
"desiredCapabilities": {
"browserName": "opera"
},
"capabilities": {
"firstMatch": [
{
"browserName": "opera"
}
]
}
}
Driver info: driver.version: unknown
I start the server with this command:
java "-Dwebdriver.opera.driver=C:\Users\user\Desktop\Auto\qa-tests\Codeception\operadriver.exe" -jar "C:\Users\user\Desktop\Auto\qa-tests\Codeception\selenium-server-standalone-3.14.0.jar"
My acceptance.suite.yaml
opera:
modules:
config:
PhpBrowser:
url: 'https://sample.com/'
WebDriver:
url: 'https://samlpe.com/'
window_size: 1900x1080 # for fullscreen shots
port: 17570
browser: opera # 'chrome' or 'firefox' java "-Dwebdriver.opera.driver=C:\Users\user\Desktop\Auto\qa-tests\Codeception\operadriver.exe" -jar "C:\Users\user\Desktop\Auto\qa-tests\Codeception\selenium-server-standalone-3.14.0.jar" -port 17570 - для MicrosoftEdge
#capabilities:
args: [ '--no-sandbox' ]
Related
My test environment has below setup:
#wdio/selenium-standalone-service": "^6.11.0"
node12 (so wdio-electron-service is not an option at the
moment)
google chrome version 102.0.5005.61
electron(#18) app version 100.0.4896.60
firefox version 101.0
By using selenium-standalone service, I am trying to create 1 electron and 1 chrome browser sessions with below 2 capabilities:
Capability #1 - electron session
capabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
binary: 'Path to Electron binary’
args: [
/* cli arguments */
], // Optional, perhaps 'app=' + /path/to/your/app/
},
},
Capability #2 - chrome browser session
capabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
args: […],
},
With selenium-standalone service, if I have following chromedriver version in installArgs and args:
drivers: {
chrome: { version: '100.0.4896.60' },
},
Capability#2 would fail to create session for chrome browser.
If I have
drivers: {
chrome: { version: 'latest' },
},
Capability#1 would fail to create session for electron app
I also tried setting the capability #2 to firefox browser instead of chrome:
capabilities: {
browserName: 'firefox'
}
with selenium-standalone installArg and args:
drivers: {
chrome: { version: '100.0.4896.60' }, // match electron app version
firefox: { version: 'latest' }, // match firefox browser version
}
Electron app session was created but firefox session still failed to create with below error:
[0-0] 2022-06-03T07:48:28.519Z ERROR #wdio/runner: Error: Failed to create session.
Unable to create session from {
"desiredCapabilities": {
"moz:firefoxOptions": {
"args": [
"-remote-debugging-port",
"50030"
]
},
"browserName": "firefox"
},
"capabilities": {
"firstMatch": [
{
"browserName": "firefox",
"moz:firefoxOptions": {
"args": [
"-remote-debugging-port",
"50030"
]
}
}
]
}
}
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '-----', ip: '----', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_231'
Driver info: driver.version: unknown
at Object.startWebDriverSession (~/node_modules/webdriver/build/utils.js:34:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Any suggestions on workaround would be appreciated.
Thank you
It seems like I cannot have multiple versions of chromedriver but I can get the Capability#2 to work by changing to firefox. I was having above driver unknown error because I specified the selenium version 3.141.59 in args but not in installArgs. Once removing/adding 3.141.59 from both args and installArgs, Firefox was working as expected. Please see below:
'selenium-standalone',
{
logPath: 'logs',
installArgs: {
version: '3.141.59',
drivers: {
chrome: { version: '100.0.4896.60' },
firefox: { version: '0.30.0' },
},
},
args: {
version: '3.141.59',
drivers: {
chrome: { version: '100.0.4896.60' },
firefox: { version: '0.30.0' },
},
},
},
I am trying to get firefox to run in webdriver.io 5. This is on a Linux cloud.
I get:
2020-02-28T02:32:33.472Z INFO #wdio/cli:launcher: Run onPrepare hook
2020-02-28T02:32:33.475Z INFO #wdio/local-runner: Start worker 0-0 with arg: wdio.conf.js
[0-0] 2020-02-28T02:32:33.818Z INFO #wdio/local-runner: Run worker command: run
[0-0] RUNNING in firefox - /build/main.js
[0-0] 2020-02-28T02:32:33.881Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-02-28T02:32:33.883Z INFO webdriver: [POST] http://127.0.0.1:4444/session
[0-0] 2020-02-28T02:32:33.883Z INFO webdriver: DATA {
capabilities: {
alwaysMatch: { browserName: 'firefox', 'moz:firefoxOptions': [Object] },
firstMatch: [ {} ]
},
desiredCapabilities: { browserName: 'firefox', 'moz:firefoxOptions': { args: [Array] } }
}
[0-0] 2020-02-28T02:32:33.899Z WARN webdriver: Request failed due to connect ECONNREFUSED 127.0.0.1:4444
[0-0] 2020-02-28T02:32:33.899Z INFO webdriver: Retrying 1/3
Here is my config:
exports.config = {
runner: 'local',
path: '/',
specs: [
'./build/**/*.js'
],
maxInstances: 10,
capabilities: [
{
"browserName": "firefox",
"moz:firefoxOptions": {
"args": ["-headless"],
}
}
],
logLevel: 'info',
bail: 0,
baseUrl: 'http://localhost',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
reporters: ['spec'],
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 60000
},
services: [
],
}```
Any ideas what I am doing wrong?
The path should be set to path: "/wd/hub" and your services seems to be empty. You can use webdriverio with mocha in two different ways. With selenium or without.
Please refer to boiler plates from official docs here
[0-0] 2020-02-28T02:32:33.899Z WARN webdriver: Request failed due to connect ECONNREFUSED 127.0.0.1:4444
If you are using selenium-standalone, please make sure that you have both the java jdk & sdk installed on your machine. let me know if this worked for you.
We are trying to execute Protractor tests in CentOS 7 vm in headless mode using chromedriver.
Versions:
Protractor- 5.4.0
Node - v6.14.3
cucumber-js - 4.2.1
Google Chrome version - Google Chrome 68.0.3440.84
Webdriver-manager running and showing following information
[bpmuser#bg-bpm-qa-jbpm6 ~]$ ps -eaf | grep java
root 3692 3685 5 17:19 pts/0 00:00:01 java -
Djava.security.egd=file:///dev/./urandom -Dwebdriver.chrome.driver=/usr/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.41 -Dwebdriver.gecko.driver=/usr/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.21.0 -jar /usr/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.14.0.jar -port 4444
protractor.conf.js:
var Cucumber = require("./node_modules/cucumber");
var { defineSupportCode } = require("./node_modules/cucumber");
var reporter = require('./node_modules/cucumber-html-reporter');
var report = require("./node_modules/cucumber-html-report");
var cucumberReportOptions = {
source: './reports/results.json',
dest: './reports/results',
name: "report_detailed.html",
title: "CDocs Automation Report",
};
var cucumberReporteroptions = {
theme: 'Bootstrap',
jsonFile: './reports/results.json',
output: './reports/results/report.html',
screenshotsDirectory: './reports/screenshots/',
storeScreenshots: true,
reportSuiteAsScenarios: true,
launchReport: false,
metadata: {
"App Version":"Angular 2.0",
"Test Environment": "QA",
"Browser": "Chrome",
"Platform": process.platform,
//"Parallel": "Scenarios",
"Scenarios" : "TestCases",
"Executed": "Local"
}
};
exports.config = {
//directConnect: true,
useAllAngular2AppRoots: true,
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
getPageTimeout: 60000,
allScriptsTimeout: 500000,
framework: "custom",
// path relative to the current config file
frameworkPath: require.resolve('./node_modules/protractor-cucumber- framework'),
//restartBrowserBetweenSuites: true,
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [ 'headless' ]
},
acceptSslCerts: true,
},
// Spec patterns are relative to this directory.
specs: ['./features/ChangeView.feature',
],
//baseURL: 'http://localhost:8080/',
onPrepare: function () {
browser.baseUrl = "http://localhost:8080/";
},
onComplete: () => {
reporter.generate(cucumberReporteroptions); //invoke cucumber-html-reporter
report
.create(cucumberReportOptions)
.then(function() {
//invoke cucumber-html-report
// creating two reports(optional) here, cucumber-html-report gives
directory already exists as cucumber-html-reporter already creates the html dir!
// suggestion- use either one of the reports based on your needs
console.log("cucumber_report.html created successfully!");
})
},
cucumberOpts: {
format: ['json:reports/results.json', 'pretty'],
require: ['./features/step_definitions/content_step_definitions.js'],
tags: true,
profile: false,
'no-source': true
}
};
However, running Protractor still does not work:
[bpmuser#bg-bpm-qa-jbpm6 bin]$ pwd
/usr/lib/node_modules/protractor/bin
[bpmuser#bg-bpm-qa-jbpm6 bin]$ ./protractor /home/bpmuser/docs/CDocsAutomation/protractor.conf.js
[18:10:33] I/launcher - Running 1 instances of WebDriver
[18:10:33] I/hosted - Using the selenium server at http://127.0.0.1:4444/wd/hub
Its not progressing after this step. Not sure where i am doing wrong.
Try using this in your config
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [ "--headless", "--disable-gpu", "--window-size=800,600" ]
}
}
hope this helps
The versions of the relevant modules:
Selenium-Webdriver: 3.6.0
Protractor: 5.3.0
Firefox: 52.7.2 (32-bit)
IE11
My protractor scripts work smoothly with chrome 65.0.3325.181 (Official Build) (64-bit).
The protractor.conf.js:
exports.config = {
directConnect: true,
seleniumAddress: 'http://localhost:4444/wd/hub',
framework: 'jasmine',
// Spec patterns are relative to the current working directory when
// protractor is called.
suites: {
spec: ['spec/full/example_spec.js']
},
multiCapabilities: [
// {
// browserName: 'chrome',
// chromeOptions: {
// args: ['disable-infobars']
// }
// },
{
'browserName': 'internet explorer',
},
// { browserName: 'firefox' }
],
maxSessions: 1,
}
Is it a bug of the protractor 5.3.0?
First, I start Selenium:
nohup java -jar selenium/selenium-server-standalone-2.47.1.jar -role hub -port 4455&
Then add PhantomJS driver:
nohup phantomjs --webdriver=8080 --webdriver-selenium-grid-hub=http://127.0.0.1:4455&
Output in nohup.out looks... successful?:
13:22:52.127 INFO - Launching Selenium Grid hub
2015-12-07 13:22:52.789:INFO:osjs.Server:jetty-7.x.y-SNAPSHOT
2015-12-07 13:22:52.833:INFO:osjsh.ContextHandler:started o.s.j.s.ServletContextHandler{/,null}
2015-12-07 13:22:52.845:INFO:osjs.AbstractConnector:Started SocketConnector#0.0.0.0:4455
13:22:52.846 INFO - Nodes should register to http://192.168.10.67:4455/grid/register/
13:22:52.846 INFO - Selenium Grid hub is up and running
PhantomJS is launching GhostDriver...
[INFO - 2015-12-07T13:22:56.097Z] GhostDriver - Main - running on port 8080
[INFO - 2015-12-07T13:22:56.097Z] GhostDriver - Main - registering to Selenium HUB 'http://127.0.0.1:4455' using '127.0.0.1:8080'
13:22:56.177 INFO - Registered a node http://127.0.0.1:8080
[INFO - 2015-12-07T13:22:56.184Z] HUB Register - register - Registered with grid hub: http://127.0.0.1:4455/ (ok)
versions in package.json include:
"devDependencies": {
"grunt": "^0.4.5",
"grunt-nightwatch": "^0.4.8",
"phantomjs": "^1.9.19"
},
My Grunt task config for Nightwatch looks like:
module.exports = {
options: { // default
standalone: false,
globals_path: 'test/globals.js',
custom_commands_path: 'test/commands',
custom_assertions_path: 'test/asserts',
page_objects_path: 'test/pages',
src_folders: ['test/specs'],
output_folder: 'test/report',
test_settings: {
"default": {
"desiredCapabilities": {
"browserName": "firefox"
}
},
"firefox": {
"desiredCapabilities": {
"browserName": "firefox"
}
},
"chrome": {
"desiredCapabilities": {
"browserName": "chrome"
}
},
"phantomjs": {
"desiredCapabilities": {
"browserName": "phantomjs",
"javascriptEnabled": true,
"acceptSslCerts": true,
"phantomjs.binary.path": "node_modules/phantomjs/bin"
}
}
},
selenium: {
"start_process": false
}
}
};
At this point I can:
grunt nightwatch:phantomjs
Which gives me:
Connection refused! Is selenium server started?
What's wrong? How do I debug it? Is it something to do with it saying nodes should register to 192.168.10.67 (my machine's local network IP), but GhostDriver is registering to 127.0.0.1 ?
I think the problem is this line:
selenium: {
"start_process": false
}
that should be changed to:
selenium: {
"start_process": true
}
In your Grunt task config for Nightwatch.This will start the Selenium process automatically when runnning the tests. If this is set to false you have to start the Selenium process manually.