WebdriverIO with CicrcleCI- getting an error for chromedriver version - circleci

i am trying to run the webdriverIO tests with cucumber framework on CircleCI, however am running into an issue at the point of executing the test command-
This is my circleCI config.yml which I am using-
version: 2.1
jobs:
build:
docker:
- image: circleci/node:10-browsers
working_directory: ~/project
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: "Install dependencies"
command: |
npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: "Run tests"
command: |
npm run test
- store_test_results:
path: ./allure-results
This is my wdio.conf.js-
exports.config = {
//
// ====================
// Runner Configuration
// ====================
//
// WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
// on a remote machine).
runner: 'local',
hostname: 'localhost',
port: 4444,
specs: [
'./features/**/*.feature'
],
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
],
maxInstances: 10,
capabilities: [{
maxInstances: 5,
browserName: 'chrome',
acceptInsecureCerts: true
}],
logLevel: 'info',
bail: 0,
baseUrl: 'http://localhost',
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
services: ['selenium-standalone'],
capabilities: [{
maxInstances: 5,
browserName: 'chrome',
}],
args: {
drivers: {
chrome: { version: '83.0.4103' },
}
},
framework: 'cucumber',
reporters: ['spec','allure'],
reporterOptions: {
allure: {
outputDir: './reports/allure-results'
}
},
cucumberOpts: {
require: ['./features/step-definitions/steps.js'],
backtrace: false,
requireModule: ['#babel/register'],
dryRun: false,
failFast: false,
formatter output (repeatable)
format: ['pretty'],
// hide step definition snippets for pending steps
snippets: true,
// hide source uris
source: true,
// <string[]> (name) specify the profile to use
profile: [],
// fail if there are any undefined or pending steps
strict: false,
// (expression) only execute the features or scenarios with tags matching the expression
tagExpression: '#runnow1',
// timeout for step definitions
timeout: 60000,
// Enable this config to treat undefined definitions as warnings.
ignoreUndefinedDefinitions: false
},
}
This is the stack trace of the error I am getting in circleCi-
[0-2] 2020-08-27T14:09:27.770Z ERROR webdriver: session not created: session not created: This version of ChromeDriver only supports Chrome version 83
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'f5e174502751', ip: '172.19.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1077-aws', java.version: '11.0.6'
Driver info: driver.version: unknown
remote stacktrace: #0 0x561324a36579 <unknown>
at getErrorFromResponseBody (/home/circleci/project/node_modules/webdriver/build/utils.js:121:10)
at WebDriverRequest._request (/home/circleci/project/node_modules/webdriver/build/request.js:149:56)
at process._tickCallback (internal/process/next_tick.js:68:7)
[0-2] 2020-08-27T14:09:27.770Z ERROR #wdio/runner: Error: Failed to create session.
session not created: This version of ChromeDriver only supports Chrome version 83
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'f5e174502751', ip: '172.19.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1077-aws', java.version: '11.0.6'
Driver info: driver.version: unknown
remote stacktrace: #0 0x561324a36579 <unknown>
at startWebDriverSession (/home/circleci/project/node_modules/webdriver/build/utils.js:45:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
[0-2] Error: Failed to create session.
session not created: This version of ChromeDriver only supports Chrome version 83
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'f5e174502751', ip: '172.19.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1077-aws', java.version: '11.0.6'
Driver info: driver.version: unknown
remote stacktrace: #0 0x561324a36579 <unknown>

This was a recent regression in the dependency WebdriverIO uses to download the proper version of Chromedriver. The WebdriverIO issue is here.
A temporary workaround suggested in that issue is to tell selenium-service to use a specific version of Chromedriver in the wdio config:
services: [
[
"selenium-standalone",
{
logPath: "logs",
installArgs: {
version: "3.141.5",
baseURL: "https://selenium-release.storage.googleapis.com",
drivers: {
chrome: {
version: "85.0.4183.83",
arch: process.arch,
baseURL: "https://chromedriver.storage.googleapis.com",
},
},
},
args: {
version: "3.141.5",
drivers: {
chrome: {
version: "85.0.4183.83",
arch: process.arch,
},
},
},
},
],
],

I'd suggest using a prebuilt image with Chrome browser or see how it was built in the Dockerfile, ex https://hub.docker.com/r/atools/chrome-headless
Here is an example repo where you can see tests passing in the pipeline https://github.com/mgrybyk/wdio-jasmine-boilerplate

Related

Error: io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0

2022-06-07 09:14:19.862 DEBUG testcase.TEST - 8: switchToWindow(findWindowsObject("Object Repository/mainWindow/mainFrame"))
lut 20, 2020 9:14:20 AM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
INFO: Detected dialect: OSS
2020-02-20 09:14:20.033 DEBUG testcase.TEST - 9: click(findWindowsObject("Object Repository/mainWindow/menuItem", ["itemName":"KOI"]))
2020-02-20 09:14:21.419 ERROR c.k.k.core.keyword.internal.KeywordMain - ❌ An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'APS00076262-MB', ip: '192.168.56.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: io.appium.java_client.windows.WindowsDriver
Capabilities {appTopLevelWindow: 808ba, javascriptEnabled: true, platform: WINDOWS, platformName: WINDOWS}
Session ID: B4334F10-B953-4EF6-B814-E43A3B191EFA
*** Element info: {Using=xpath, value=//MenuItem[#Name="${itemName}"]} (Root cause: org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'APS00076262-MB', ip: '192.168.56.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: io.appium.java_client.windows.WindowsDriver
Capabilities {appTopLevelWindow: 808ba, javascriptEnabled: true, platform: WINDOWS, platformName: WINDOWS}
Session ID: B4334F10-B953-4EF6-B814-E43A3B191EFA
*** Element info: {Using=xpath, value=//MenuItem[#Name="${itemName}"]}

Driver info: driver.version: unknown error running Selenium and Codeception in DDEV (Mac M1)

I was using VirtualBox for development when i had a windows pc. Later i bought a Macbook M1 and installed the DDEV instead of VirtualBox.
In my old development virtualbox, i installed selenium and chromedriver in Virtualbox. With this setup i could run Codeception Tests.
Since i'm using DDEV for development, i tired to install Selenium-chromedriver with following tutorials:
https://dev.to/tomasnorre/codeception-ddev-selenium-docker-36kk
https://docs.typo3.org/m/typo3/reference-coreapi/9.5/en-us/Testing/ProjectTesting.html
My docker-compose.selenium.yaml File
version: '3.6'
services:
selenium:
container_name: ddev-${DDEV_SITENAME}-chrome
image: selenium/standalone-chrome:latest
environment:
- VIRTUAL_HOST=$DDEV_HOSTNAME
- HTTP_EXPOSE=4444
external_links:
- ddev-router:$DDEV_HOSTNAME
codeception.yaml File
# suite config
suites:
acceptance:
actor: AcceptanceTester
path: .
modules:
enabled:
- WebDriver:
url: http://test.ddev.site
host: ddev-test-chrome
browser: chrome
- \Helper\Acceptance
I get following Error when i try to execute a Test in ddev ssh with php vendor/bin/codecept run tests/FirstCest.php
[Facebook\WebDriver\Exception\SessionNotCreatedException] Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: '4916a3762177', ip: '172.18.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.76-linuxkit', java.version: '11.0.13'
Driver info: driver.version: unknown
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: '4916a3762177', ip: '172.18.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.76-linuxkit', java.version: '11.0.13'
Driver info: driver.version: unknown
Is it possible, that the errors are related to M1-Chip or am i doing something wrong?
The selenium/standalone-chrome image is not built for arm64 (Mac M1). In fact, the chrome package it probably derives from is not available at all for arm64.
However, the chromium package is available for arm64. You may be able to use justinribeiro/chrome-headless:chromium, which is built for arm64.
Also, take a look at https://github.com/drud/ddev-contrib/tree/master/docker-compose-services/headless-chrome, which has been updated to use the arm64 chromium image.
This error message...
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: '4916a3762177', ip: '172.18.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.76-linuxkit', java.version: '11.0.13'
Driver info: driver.version: unknown
...implies that the ChromeDriver version wasn't detected.
Presumably the main issue is the incompatibility between the version of the binaries you are using.
Solution
Ensure that:
ChromeDriver is updated to current ChromeDriver v96.0 level.
Chrome is updated to current chrome=96.0.4664.45 (as per chrome=96.0.4664.45 release notes).

UnhandledPromiseRejectionWarning: WebDriverError: unknown error: Chrome failed to start: crashed error running Selenium tests with docker-compose

while trying to run slenium tests from docker which we use in most projects i get this error saying chrome has crashed i 've both google chrome and chrome driver installed and working fine any help with this ?
(node:231) UnhandledPromiseRejectionWarning: WebDriverError: unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '1a84fd607b36', ip: '172.27.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.47-linuxkit', java.version: '1.8.0_292'
Driver info: driver.version: unknown
remote stacktrace: #0 0x00400068e949 <unknown>
This error message...
(node:231) UnhandledPromiseRejectionWarning: WebDriverError: unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '1a84fd607b36', ip: '172.27.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.47-linuxkit', java.version: '1.8.0_292'
Driver info: driver.version: unknown
remote stacktrace: #0 0x00400068e949 <unknown>
...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 java.version: '1.8.0_292' and the error being:
Driver info: driver.version: unknown
remote stacktrace: #0 0x00400068e949 <unknown>
Solution
Ensure that:
JDK is upgraded to current levels JDK 8u311.
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v95.0 level.
Chrome is updated to current Chrome Version 95.0 level. (as per ChromeDriver v95.0 release notes).

Grails Geb: Chrome failed to start

I'm trying to set up geb functional testing in Grails, then I get "chrome failed to start". Could anyone help me out?
Exception Details:
Starting ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) on port 9374
Only local connections are allowed.
Failure: |
unauthorized login to the home page(com.myapp.HomeFunctionalSpec)
|
geb.driver.DriverCreationException: failed to create driver from callback 'script1426780645607568441896$_run_closure1#b0894c'
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:80)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:30)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:79)
at geb.Configuration.createDriver(Configuration.groovy:354)
at geb.Configuration.getDriver(Configuration.groovy:343)
at geb.Browser.getDriver(Browser.groovy:105)
at geb.Browser.clearCookies(Browser.groovy:483)
at geb.Browser.clearCookiesQuietly(Browser.groovy:491)
at geb.spock.GebSpec.resetBrowser(GebSpec.groovy:45)
at geb.spock.GebSpec.cleanup(GebSpec.groovy:67)
Caused by: org.openqa.selenium.WebDriverException: unknown error: chrome failed to start
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 586 milliseconds
Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39'
System info: host: 'ILWS011', ip: '192.168.0.107', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.chrome.ChromeDriver.startSession(ChromeDriver.java:181)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:160)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:149)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:106)
at script1426780645607568441896.run_closure1(script1426780645607568441896.groovy:5)
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29)
... 10 more
Below is the BuildConfig.groovy
def gebVersion = "0.9.2"
def seleniumVersion = "2.41.0"
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
....
test "org.apache.httpcomponents:httpcore:4.2.3"
test "org.gebish:geb-spock:$gebVersion"
test "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
test "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
}
plugins {
// plugins needed at test environment
test ":geb:$gebVersion"
}
test/functional/GebGonfig.groovy
import org.openqa.selenium.chrome.ChromeDriver
driver = {
System.setProperty("webdriver.chrome.driver", "C://chromedriver//chromedriver.exe")
new ChromeDriver()
}
I'm using the Chromedriver2.14, and putting it in C:/chromedriver/
Did I set everything right? Are the versions matching with each other?
It's maybe because of old selenium Version. Use 2.45 and the newest webdriver.

Problems starting iOS driver

I am having difficulty with executing a test with my driver.
1) I start my server with the following (grid does not start as I am getting kicked out… for another thread)
java -jar ios-server-standalone-0.6.6-SNAPSHOT.jar -port 1111
2) I launch a test from the respective directory
3) The logs dump the following:
The server cannot run Capabilities [{platform=MAC, cssSelectorsEnabled=false, CFBundleIdentifier=com.apple.mobilesafari, javascriptEnabled=true, nativeEvents=false, locale=en_GB, CFBundleName=Safari, variation=Retina4, device=iphone, rotatable=false, takesScreenshot=false, sdkVersion=7.1, version=}] at the moment.org.uiautomation.ios.application.APPIOSApplication cannot be cast to org.uiautomation.ios.application.IPAApplication
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: '(hidden for privacy)', ip: '(hidden for privacy)', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_67'
Driver info: driver.version: unknown
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: '(hidden for privacy)', ip: '(hidden for privacy)', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_67'
Driver info: driver.version: unknown (org.openqa.selenium.SessionNotCreatedException) (Selenium::WebDriver::Error::WebDriverError)
[remote server] org.uiautomation.ios.command.uiautomation.NewSessionNHandler(NewSessionNHandler.java):100:in `safeStart'
What is the root cause?
Having had the exact same issue, you could try using
capabilities.setCapability("simulator", true);
This got me past this issue at least (and into another one).

Resources