WebdriverIO 5 - 'browser.$(...).click is not a function' error - webstorm

I am new to WebdriverIO. I was trying to execute my first feature file and I get this error :
[chrome windows #0-0] browser.$(...).click is not a function
[chrome windows #0-0] TypeError: browser.$(...).click is not a function
But I can see the click() function listed in the auto suggestions when I type the code in the editor. Can someone point out what I am doing wrong?
Here is my Step definition file :
import {Given, Then} from "cucumber";
Given(/^I navigated to RPA Challenge website$/, function() {
browser.url("http://rpachallenge.com/");
});
Then(/^I see the submit button$/, function () {
browser.$("/html/body/app-root/div[2]/app-rpa1/div/div[2]/form/input").click();
console.log("URL is "+browser.getUrl());
});
Here is my package.json file :
{
"name": "WebdriverIO_2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#babel/cli": "^7.8.4",
"#babel/core": "^7.8.6",
"#babel/preset-env": "^7.8.6",
"#babel/register": "^7.8.6",
"#wdio/cli": "^5.18.7",
"#wdio/cucumber-framework": "^5.18.6",
"#wdio/local-runner": "^5.18.7",
"#wdio/spec-reporter": "^5.18.7",
"#wdio/sync": "^5.18.7",
"babel-core": "^6.26.3",
"babel-preset-env": "^1.7.0",
"chromedriver": "^80.0.1",
"cucumber": "^6.0.5",
"install": "^0.13.0",
"wdio-chromedriver-service": "^5.0.2",
"webdriverio": "^5.18.7"
},
"dependencies": {
"wdio-selenium-standalone-service": "0.0.12"
}
}
Output and Error message :
C:\Users\myusername\Desktop\WebdriverIO3>node_modules\.bin\wdio wdio.conf.js
2020-03-04T07:18:16.130Z DEBUG #wdio/sync: Couldn't load fibers package for Node v10 and above
2020-03-04T07:18:16.130Z DEBUG #wdio/sync: Couldn't load fibers package for Node v8
Execution of 1 spec files started at 2020-03-04T07:18:18.858Z
2020-03-04T07:18:19.124Z INFO #wdio/cli:launcher: Run onPrepare hook
Starting ChromeDriver 80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987#{#185}) on port 4444
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
2020-03-04T07:18:19.940Z INFO #wdio/local-runner: Start worker 0-0 with arg: wdio.conf.js
[0-0] 2020-03-04T07:18:22.709Z INFO #wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - C:\Users\myusername\Desktop\WebdriverIO3\features\login.feature
[0-0] 2020-03-04T07:18:24.759Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-03-04T07:18:24.766Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session
[0-0] 2020-03-04T07:18:24.766Z INFO webdriver: DATA { capabilities: { alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
desiredCapabilities: { browserName: 'chrome' } }
[3132:23720:0304/124825.906:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: AlwaysAuthorizePlugins
[3132:23720:0304/124825.906:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: DisablePluginFinder
[3132:23720:0304/124825.906:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: PasswordManagerAllowShowPasswords
[3132:23720:0304/124826.015:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: AlwaysAuthorizePlugins
[3132:23720:0304/124826.015:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: DisablePluginFinder
[3132:23720:0304/124826.015:ERROR:configuration_policy_handler_list.cc(90)] Unknown policy: PasswordManagerAllowShowPasswords
DevTools listening on ws://127.0.0.1:53324/devtools/browser/9124ea53-8ac6-483b-8bba-3dcdf611bb28
[0-0] 2020-03-04T07:18:34.702Z INFO webdriver: COMMAND navigateTo("http://rpachallenge.com/")
[0-0] 2020-03-04T07:18:34.703Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session/0132136b9c7a963983c93889b31c16d5/url
2020-03-04T07:18:34.703Z INFO webdriver: DATA { url: 'http://rpachallenge.com/' }
[0-0] 2020-03-04T07:18:34.712Z INFO webdriver: COMMAND findElement("xpath", "/html/body/app-root/div[2]/app-rpa1/div/div[2]/form/input")
[0-0] 2020-03-04T07:18:34.713Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session/0132136b9c7a963983c93889b31c16d5/element
[0-0] 2020-03-04T07:18:34.714Z INFO webdriver: DATA { using: 'xpath',
value: '/html/body/app-root/div[2]/app-rpa1/div/div[2]/form/input' }
[0-0] Error in "RPA Challenge website launch: scenario 1: Then I see the submit button"
browser.$(...).click is not a function
[0-0] 2020-03-04T07:18:34.775Z INFO webdriver: COMMAND deleteSession()
[0-0] 2020-03-04T07:18:34.777Z INFO webdriver: [DELETE] http://127.0.0.1:4444/wd/hub/session/0132136b9c7a963983c93889b31c16d5
[1583306316.590][SEVERE]: Timed out receiving message from renderer: 0.100
[1583306316.692][SEVERE]: Timed out receiving message from renderer: 0.100
[1583306316.796][SEVERE]: Timed out receiving message from renderer: 0.100
[1583306316.898][SEVERE]: Timed out receiving message from renderer: 0.100
[0-0] 2020-03-04T07:19:14.197Z INFO webdriver: RESULT { 'element-6066-11e4-a52e-4f735466cecf': '54156a65-2e41-4f61-b9fe-7669cf591b1c' }
[0-0] FAILED in chrome - C:\Users\myusername\Desktop\WebdriverIO3\features\login.feature
2020-03-04T07:19:14.593Z INFO #wdio/cli:launcher: Run onComplete hook
"spec" Reporter:
------------------------------------------------------------------
[chrome windows #0-0] Spec: C:\Users\myusername\Desktop\WebdriverIO3\features\login.feature
[chrome windows #0-0] Running: chrome on windows
[chrome windows #0-0] Session ID: 0132136b9c7a963983c93889b31c16d5
[chrome windows #0-0]
[chrome windows #0-0] RPA Challenge website launch
[chrome windows #0-0] scenario 1
[chrome windows #0-0] ✓ Given I navigated to RPA Challenge website
[chrome windows #0-0] ✖ Then I see the submit button
[chrome windows #0-0]
[chrome windows #0-0] 1 passing (44.3s)
[chrome windows #0-0] 1 failing
[chrome windows #0-0]
[chrome windows #0-0] 1) scenario 1 Then I see the submit button
[chrome windows #0-0] browser.$(...).click is not a function
[chrome windows #0-0] TypeError: browser.$(...).click is not a function
[chrome windows #0-0] at World.<anonymous> (C:\Users\myusername\Desktop\WebdriverIO3\stepDefs/Login.stepdef.js:8:76)
[chrome windows #0-0] at World.executeAsync (C:\Users\myusername\Desktop\WebdriverIO3\node_modules\#wdio\utils\build\shim.js:123:21)
[chrome windows #0-0] at World.testFrameworkFnWrapper (C:\Users\myusername\Desktop\WebdriverIO3\node_modules\#wdio\utils\build\test-framework\testFnWrapper.js:55:28)
[chrome windows #0-0] at <anonymous>
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:55
2020-03-04T07:19:14.600Z INFO #wdio/local-runner: Shutting down spawned worker
2020-03-04T07:19:14.860Z INFO #wdio/local-runner: Waiting for 0 to shut down gracefully
2020-03-04T07:19:14.860Z INFO #wdio/local-runner: shutting down

The error occurs because of fibers.
2020-03-04T07:18:16.130Z DEBUG #wdio/sync: Couldn't load fibers package for Node v10 and above
The easiest fix for me was to add fibers to the devDependencies.
Also see: https://github.com/webdriverio/webdriverio/issues/4913

Cannot read property 'click' of undefined
Cannot read property 'getText' of undefined
Cannot read property 'waitForClickable' of undefined
are all the same issues.
Most likely your variable name is either: not defined, or misspelled.
If you have this type of errors, always refer to whatever you have right before click, getText, waitForClickable.
Example:
this.loginPage.loginBtn.click(); loginBtn
is where issue is hidden. See if you can go into definition of that selector to verify referencing
Please check this link https://codemify.com/automation/9-Errors-explanation

I have just tried the same code in the project I have and it works perfectly. I assume the issue is with your config and I have put my config below. Also, you can refer my config from here as well.
I have tried with and without sync: true. Works on both occasions.
Cheers!
global.log4js = require('../log4js.config').log4js;
exports.config = {
runner: 'local',
specs: [
'./features/*.feature',
],
exclude: [],
maxInstances: 5,
capabilities: [{
'maxInstances': 1,
'browserName': 'chrome',
'goog:chromeOptions': {
w3c: true,
args: ['--headless'],
},
}, ],
// logLevel: 'info',
logLevels: {
'webdriverio': 'error',
'webdriver': 'error',
'#wdio/applitools-service': 'error',
'#wdio/browserstack-service': 'error',
'#wdio/devtools-service': 'error',
'#wdio/sauce-service': 'error',
'#wdio/mocha-framework': 'error',
'#wdio/jasmine-framework': 'error',
'#wdio/local-runner': 'error',
'#wdio/lambda-runner': 'error',
'#wdio/sumologic-reporter': 'error',
'#wdio/cli': 'error',
'#wdio/config': 'error',
'#wdio/sync': 'error',
'#wdio/utils': 'error',
},
sync: true,
coloredLogs: true,
bail: 0,
baseUrl: 'https://www.phptravels.net/',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
services: ['selenium-standalone'],
framework: 'cucumber',
// specFileRetries: 1,
reporters: [
['allure', {
outputDir: 'allure-results',
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: false,
useCucumberStepReporter: false,
}],
['cucumberjs-json', {
jsonFolder: 'reports',
language: 'en',
}],
],
cucumberOpts: {
requireModule: ['#babel/register'],
require: ['./features/step-definitions/*.js'], // <string[]> (file/dir) require files before executing features
backtrace: true, // <boolean> show full backtrace for errors
failAmbiguousDefinitions: true, // <boolean< Treat ambiguous definitions as errors
dryRun: false, // <boolean> invoke formatters without executing steps
failFast: false, // <boolean> abort the run on first failure
ignoreUndefinedDefinitions: false, // <boolean> Enable this config to treat undefined definitions as warnings
format: ['pretty'], // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
colors: true, // <boolean> disable colors in formatter output
snippets: false, // <boolean> hide step definition snippets for pending steps
source: false, // <boolean> hide source uris
profile: [], // <string[]> (name) specify the profile to use
strict: true, // <boolean> fail if there are any undefined or pending steps
tagExpression: '', // <string> (expression) only execute the features or scenarios with tags matching the expression
timeout: 60000, // <number> timeout for step definitions
ignoreUndefinedDefinitions: false, // <boolean> Enable this config to treat undefined definitions as warnings.
},
};

Try changing
browser.$(...).click
to
$().click
the click command gets called on the element, not the browser.

Related

Import Azure Data explorer Arm Template fails

i exported my arm template from develop environment related to my Azure Data Explorer.
Now i'am trying to import it in test environment but the process fails:
New-AzResourceGroupDeployment : 12:18:24 - The deployment 'template' failed with error(s). Showing 3 out of 10 error(s). Status Message: [BadRequest] Validation Errors found: mapping does not exist (Code:EventHubValidationErrorFound) Status Message: [BadRequest] Validation Errors found: mapping does not exist (Code:EventHubValidationErrorFound) Status Message: [BadRequest] Validation Errors found: mapping does not exist (Code:EventHubValidationErrorFound) CorrelationId: b27cdf8e-c583-4dee-8dbc-2b0e4876b8ca
I have different Data Connections from my Azure DATA Explorer to an Event HUB:
`
{
"type": "Microsoft.Kusto/Clusters/Databases/EventHubConnections",
"apiVersion": "2018-09-07-preview",
"name": "[concat(parameters('Clusters_xyzazne_name'), '/asd/asd-fondi')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.Kusto/Clusters/Databases', parameters('Clusters__name'), 'DNA_R_NRT')]",
"[resourceId('Microsoft.Kusto/Clusters', parameters('Clusters__name'))]"
],
"kind": "EventHub",
"properties": {
"eventHubResourceId": "[concat(parameters('namespaces_ehub_externalid'), '/eventhubs/fondi')]",
"consumerGroup": "fondi_consumer",
"tableName": "fondi",
"mappingRuleName": "fondi_mapping",
"dataFormat": "multijson"
}
}
`
I'm trying to import an Azure Data Explorer Arm Template to another environment but fails

Karma+Jasmine tests not running with Chrome, "Executed 0 of 0 ERROR"

I'm trying to test my project angular 5 with jasmine and karma but it show me this error:
myProject\Front\src\app> ng test
Your global Angular CLI version (7.0.3) is greater than your local
version (1.7.4). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
30 10 2018 09:42:25.435:WARN [karma]: No captured browser, open http://localhost:9876/
30 10 2018 09:42:38.011:INFO [karma]: Karma v0.13.9 server started at http://localhost:9876/
30 10 2018 09:42:38.016:INFO [launcher]: Starting browser Chrome
30 10 2018 09:42:41.074:INFO [Chrome 69.0.3497 (Windows 10 0.0.0)]: Connected on socket RiQkM_n-0oc-xuYAAAAA with id 49828596
Chrome 69.0.3497 (Windows 10 0.0.0) ERROR: 'DEPRECATION:', 'Setting specFilter directly on Env is deprecated, please use the specFilter option in `configure`'
Chrome 69.0.3497 (Windows 10 0.0.0): Executed 0 of 0 ERROR (0.003 secs / 0 secs)
and this is my karma.conf.js :
// Karma configuration
// Generated on Mon Oct 29 2018 16:09:43 GMT+0000 (Maroc)
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
//plugin needed
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
],
// list of files / patterns to load in the browser
files: [
'src/app/*.spec.ts',
],
// list of files / patterns to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
and this the interface in Google Chrome:
I'm just a beginner 😄 and I'm not sure if those informations are enough. I tried a lot of solutions that I found but always the same problem. Can someone help me?
This is a result of an incompatibility with newer versions of Chrome (failing for me with version 70) and the newest version of jasmine (3.3.0). The short term workaround is to lock your jasmine-core version to 3.2.0.

Karma tests fail with Browser DISCONNECTED error, exit code: 1

We have a total of 2016 unit test cases written with Jasmine and are using Karma to run them. The tests run for a period of 1 min 30 sec to 2 min and then suddenly Karma disconnects from the browser.Here is a screenshot of the console logs.
The problem is that I am not able to diagnose why that is happening and which test case is causing it to get disconnected. I have tried different reporters of Karma to be able to identify the test case which forces it to disconnect from the browser but have been unsuccessful so far.
I have also tried running the tests in short batches to be able to drill down to the error test case (in case it is a test case error and not Karma configuration) but so far, the error has been thrown for all batches.
As per this post, I have tried setting the browserNoActivityTimeout to as high as 10 minutes (600000ms) but still no resolution. Also, the post mentions that there might be a problem with insufficient memory, so I have tried running the cases in one 8GB RAM and one 16GB RAM systems (Windows 10 on both).
Here's the complete stack trace:
[02:06:48] Error: MyApp Chromebook Unit tests failed with exitCode: 1
at formatError (C:\Users\barnadeep.bhowmik\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:169:10)
at Gulp.<anonymous> (C:\Users\barnadeep.bhowmik\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:195:15)
at emitOne (events.js:96:13)
at Gulp.emit (events.js:188:7)
at Gulp.Orchestrator._emitTaskDone (C:\Users\barnadeep.bhowmik\Desktop\Projects\MyProject\test-player-15-may\myapp-chrome\node_modules\orchestrator\index.js:264:8)
at C:\Users\barnadeep.bhowmik\Desktop\Projects\MyProject\test-player-15-may\myapp-chrome\node_modules\orchestrator\index.js:275:23
at finish (C:\Users\barnadeep.bhowmik\Desktop\Projects\MyProject\test-player-15-may\myapp-chrome\node_modules\orchestrator\lib\runTask.js:21:8)
at cb (C:\Users\barnadeep.bhowmik\Desktop\Projects\MyProject\test-player-15-may\myapp-chrome\node_modules\orchestrator\lib\runTask.js:29:3)
at C:\Users\barnadeep.bhowmik\Desktop\Projects\MyProject\test-player-15-may\myapp-chrome\build\tasks\test.js:18:13
at removeAllListeners (C:\Users\barnadeep.bhowmik\Desktop\Projects\MyProject\test-player-15-may\myapp-chrome\node_modules\karma\lib\server.js:336:7)
at Server.<anonymous> (C:\Users\barnadeep.bhowmik\Desktop\Projects\MyProject\test-player-15-may\myapp-chrome\node_modules\karma\lib\server.js:347:9)
at Server.g (events.js:291:16)
at emitNone (events.js:91:20)
at Server.emit (events.js:185:7)
at emitCloseNT (net.js:1555:8)
at _combinedTickCallback (internal/process/next_tick.js:71:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
Here's my config file:
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'bower_components/jquery/dist/jquery.js',
'node_modules/angular/angular.js',
'other_dependencies/**.*.js',
'src/app/app.js',
'src/app/pack1-components/**/*.js',
'src/app/pack2-components/**/*.js',
'src/**/*.html'
],
exclude: [
'src/some-folder/*',
],
port: 8081,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['ChromeNoSandbox'],//temp fix for Chrome Browser 'Chrome'
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
reporters: ["spec","progress","coverage","html"],
specReporter: {
maxLogLines: 5, // limit number of lines logged per test
suppressErrorSummary: false, // do not print error summary
suppressFailed: false, // do not print information about failed tests
suppressPassed: false, // do not print information about passed tests
suppressSkipped: true, // do not print information about skipped tests
showSpecTiming: false, // print the time elapsed for each spec
failFast: true // test would finish with error when a first fail occurs.
},
preprocessors: {
'src/**/*.js':['coverage'],
'src/**/*.html':['ng-html2js']
},
coverageReporter: {
type: 'lcov',
dir: 'qualityreports/testresults/unit/coverage/'
},
htmlReporter: {
outputFile: 'qualityreports/testresults/unit/testresults.html'
},
browserNoActivityTimeout: 600000,
captureTimeout: 60000,
browserDisconnectTimeout : 60000,
browserDisconnectTolerance : 1,
ngHtml2JsPreprocessor: {
},
plugins: [
'karma-jasmine','karma-chrome-launcher','karma-coverage','karma-htmlfile-reporter','karma-ng-html2js-preprocessor',"karma-spec-reporter"],
singleRun: true
});
};
Here is a similar post but it did not have all details, hence posting mine. Any help would be deeply appreciated.

IE 11.0.9600.18538 "state":"session not created" while doing testing of polymer application with WCT

Getting the error while running the test case for polymer application. I am not getting where I am doing wrong.
Error is:
IE 11.0.9600.18538 Tests failed:{
"state":"session not created",
"sessionId":null,
"hCode":613752704,
"value":{
"additionalInformation":"\nDriver info: driver.version: InternetExplorerDriver",
"localizedMessage":"Unable to create new remote session. desired capabilities = Capabilities [{browserName
=internet explorer, javascriptEnabled=true, version=11.0.9600.18538, platform=ANY}], required capabilities = Capabilities [{}]\nBuild info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'\nSystem info: host: 'HIGURL62680', ip: '10.97.6.223', os.name: 'Windows 7', os.arch: 'a
md64', os.version: '6.1', java.version: '1.8.0_121'\nDriver info: driver.version: InternetExplorerDriver",
"supportUrl":null,
"systemInformation":"System info: host: 'HIGURL62680', ip: '10.97.6.223', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'",
"cause":null,
"stackTrace":[
{
"fileName":"ProtocolHandshake.java",
"nativeMethod":false,
"methodName":"createSession",
"className":"org.openqa.selenium.remote.ProtocolHandshake",
"hCode":-960127865,
"lineNumber":91,
"class":"java.lang.StackTraceElement"
}
],
"suppressed":[
],
Please tell me where I am going wrong.

Selenium Grid WebDriver Unable to create new remote session desired capabilities

I am trying out Selenium Grid. My tests are written in Selenium Python.
I have started the Grid hub on my local machine, I have registered the node for IE using a json file on the same machine.
I run a selenium sample test and I get the following error:
Unable to create new remote session desired capabilities
Full error trace:
Traceback (most recent call last):
File "E:\RL Fusion\projects\Selenium Grid\Selenium Grid Sample\Test1 working - try json config file 2\Test1.py", line 21, in setUp
desired_capabilities=desired_cap)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 89, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 138, in start_session
'desiredCapabilities': desired_capabilities,
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 195, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 170, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: Unable to create new remote session. desired capabilities = Capabilities [{browserName=internet explorer, javascriptEnabled=true, platform=WINDOWS}], required capabilities = null
Build info: version: '3.0.0-beta3', revision: 'c7b525d', time: '2016-09-01 14:57:03 -0700'
System info: host: 'OptimusPrime-PC', ip: '192.168.0.2', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_31'
Driver info: driver.version: InternetExplorerDriver
Stacktrace:
at org.openqa.selenium.remote.ProtocolHandshake.createSession (ProtocolHandshake.java:80)
at org.openqa.selenium.remote.HttpCommandExecutor.execute (HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute (DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:597)
at org.openqa.selenium.remote.RemoteWebDriver.startSession (RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.startSession (RemoteWebDriver.java:228)
at org.openqa.selenium.ie.InternetExplorerDriver.run (InternetExplorerDriver.java:180)
at org.openqa.selenium.ie.InternetExplorerDriver.<init> (InternetExplorerDriver.java:172)
at org.openqa.selenium.ie.InternetExplorerDriver.<init> (InternetExplorerDriver.java:148)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (None:-2)
at sun.reflect.NativeConstructorAccessorImpl.newInstance (None:-1)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (None:-1)
at java.lang.reflect.Constructor.newInstance (None:-1)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor (DefaultDriverProvider.java:103)
at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance (DefaultDriverProvider.java:97)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance (DefaultDriverFactory.java:60)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call (DefaultSession.java:222)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call (DefaultSession.java:209)
at java.util.concurrent.FutureTask.run (None:-1)
at org.openqa.selenium.remote.server.DefaultSession$1.run (DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker (None:-1)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (None:-1)
at java.lang.Thread.run (None:-1)
json.cfg.json config implementation:
{
"class": "org.openqa.grid.common.RegistrationRequest",
"capabilities": [
{
"seleniumProtocol": "WebDriver",
"browserName": "internet explorer",
"version": "11",
"maxInstances": 1,
"platform" : "WIN7" }
],
"configuration" : {
"port": 5555,
"register": true,
"host": "192.168.0.6",
"proxy": "org.openqa.grid.selenium.proxy. DefaultRemoteProxy",
"maxSession": 2,
"hubHost": "192.168.0.6",
"role": "webdriver",
"registerCycle": 5000,
"hub": "http://192.168.0.6:4444/grid/register",
"hubPort": 4444,
"remoteHost": "http://localhost:4444"
}
}
the setup method in my Selenium Python file is:
def setUp(self):
desired_cap = {'browserName': 'internet explorer',
#'platform': 'WIN8_1',
'platform': 'WIN7',
'javascriptEnabled': True}
self.driver = webdriver.Remote(
command_executor='http://localhost:4444/wd/hub',
desired_capabilities=desired_cap)
What am i doing wrong? Is my desired Capabilities not configured properly?
I notice in the full trace log it says Win 8.1
I have mentioned Win7 for the platform. I do not know why it is trying for Win 8.1
I have now changed desired capabilities to the following:
desired_cap = {'browserName': 'internet explorer',
'platform': 'windows',
'javascriptEnabled': True,
'InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS': True
}
I now get the error:
WebDriverException: Message: Error forwarding the new session cannot find : Capabilities [{browserName=internet explorer, InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS=true, javascriptEnabled=true, platform=XP}]
I need some help please.
Thanks, Riaz
The Grid uses the below three attributes in its DefaultCapabilitiesMatcher to decide on which node should a new session request be routed to :
Platform
BrowserType
Browser version
In your case, based on what you changed, your test is requesting that a node that has IE running on Windows, but in your nodeConfig.json you have basically specified "WIN7".
I dont think specifying "WINDOWS" will work for you. You can try changing your desired capabilities to refer to WIN7 and that should work.
Just keep the setting for Security of IE with middle (middle to high) and enable protected Mode for all.
Then issue got resolved.