applesimutils --list returns empty list [] after MacOS Mojave and Xcode 11.3 update - detox

Describe the bug
After upgrading my MacOS from High Sierra to Mojave and Xcode from 10.x to 11.3, I'm no longer able to run the Detox test.. It gives me this error below about not having iOS simulators.
**DetoxRuntimeError: Failed to find a device by UDID = "7C50BE35-0CDE-413A-A08D-784E98C61010" and by type = "iPhone 11 Pro"
HINT: Run 'applesimutils --list' to list your supported devices. It is advised only to specify a device type, e.g., "iPhone Xʀ" and avoid explicit search by OS version.
at SimulatorDriver._queryDevices (../node_modules/detox/src/devices/drivers/SimulatorDriver.js:224:13)**
So I ran applesimutils --list command and received empty list like below.
[
]
But if I run xcrun simctl list devices then I get the list of devices pertaining to iOS 13.3
To Reproduce
[Yes] I have tested this issue on the latest Detox release and it still reproduces
Provide the steps necessary to reproduce the issue. If you are seeing a regression, try to provide the last known version where the issue did not reproduce.
Upgrade MacOS from High Sierra to Mojave and Xcode from 10.x to 11.3 (latest)
Run "detox text"
Got this error
DetoxRuntimeError: Failed to find a device by UDID = "7C50BE35-0CDE-413A-A08D-784E98C61010" and by type = "iPhone 11 Pro"
HINT: Run 'applesimutils --list' to list your supported devices. It is advised only to specify a device type, e.g., "iPhone Xʀ" and avoid explicit search by OS version.
at SimulatorDriver._queryDevices (../node_modules/detox/src/devices/drivers/SimulatorDriver.js:224:13)
Ran applesimutils --list command. Received an empty list
[
]
But if I run xcrun simctl list devices then I get the list of devices pertaining to iOS 13.3. I even changed my package.json to reflect the latest migration guide link below and included the device object - https://github.com/wix/Detox/blob/master/docs/Guide.Migration.md
This is how my package.json looks like
"detox": {
"configurations": {
"ios.sim.debug": {
"type": "ios.simulator",
"binaryPath": "build/native/QuickSightiOS-2.0.2096.d.d.app",
"build": "xcodebuild -project ios/quicksight-react-native-mobile-tests.xcodeproj -scheme quicksight-react-native-mobile-tests -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"device": {
"type": "iPhone 11 Pro",
"id": "7C50BE35-0CDE-413A-A08D-784E98C61010"
}
}
},
"test-runner": "jest"
},`
I went to this website https://github.com/wix/AppleSimulatorUtils and reran the applesimutils commands again..
brew tap wix/brew
brew install applesimutils
After running the 2nd command above, i got this error
**4c32759b84a9:QuicksightReactNativeMobileTests kondurc$ brew install applesimutils
Updating Homebrew...
Error: applesimutils: /usr/local/Homebrew/Library/Taps/wix/homebrew-brew/applesimutils.rb:4: syntax error, unexpected <<, expecting end
<<<<<<< HEAD
^~
/usr/local/Homebrew/Library/Taps/wix/homebrew-brew/applesimutils.rb:18: syntax error, unexpected ===, expecting end
^~~
/usr/local/Homebrew/Library/Taps/wix/homebrew-brew/applesimutils.rb:24: syntax error, unexpected >>, expecting end
Detox Instruments 1.9.9...
^~
/usr/local/Homebrew/Library/Taps/wix/homebrew-brew/applesimutils.rb:24: unexpected fraction part after numeric literal
Detox Instruments 1.9.9876**
Expected behavior
I would expect applesimutils --list command to show the list of simulators supported and eventually my detox test to run successfully instead of complaining about failing to find the device type.
Environment (please complete the following information):
- Detox: 14.9.2
- React Native: 0.60.4
- Node: v10.15.1
- Device: iPhone 11 Pro (simulator)
- Xcode: 11.3
- iOS: 13.3
- macOS: Mojave
Device and Verbose Detox Logs
4c32759b84a9:QuicksightReactNativeMobileTests kondurc$ detox test --loglevel trace
detox[63893] INFO: [test.js] configuration="ios.sim.debug" loglevel="trace" reportSpecs=true DETOX_START_TIMESTAMP=1578349653101 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 "e2e"
detox[63894] INFO: [DetoxServer.js] server listening on localhost:50258...
detox[63894] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:50258
detox[63894] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"6d94b773-5329-fab7-89ae-add64e14cdec","role":"tester"},"messageId":0}
detox[63894] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=6d94b773-5329-fab7-89ae-add64e14cdec
detox[63894] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=6d94b773-5329-fab7-89ae-add64e14cdec
detox[63894] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"6d94b773-5329-fab7-89ae-add64e14cdec","role":"tester"},"messageId":0}
detox[63894] DEBUG: [exec.js/EXEC_CMD, #0] applesimutils --list --byId 7C50BE35-0CDE-413A-A08D-784E98C61010 --byType "iPhone 11 Pro"
detox[63894] TRACE: [exec.js/EXEC_SUCCESS, #0] [
]
detox[63894] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR]
DetoxRuntimeError: Failed to find a device by UDID = "7C50BE35-0CDE-413A-A08D-784E98C61010" and by type = "iPhone 11 Pro"
HINT: Run 'applesimutils --list' to list your supported devices. It is advised only to specify a device type, e.g., "iPhone Xʀ" and avoid explicit search by OS version.
at SimulatorDriver._queryDevices (/Users/kondurc/Desktop/quicksightmobiletests/src/QuicksightReactNativeMobileTests/node_modules/detox/src/devices/drivers/SimulatorDriver.js:224:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
detox[63894] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onAfterAll()
detox[63894] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=6d94b773-5329-fab7-89ae-add64e14cdec
detox[63894] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
FAIL e2e/specs/signinWithADUserTests.spec.js
Sign In using Enterprise AD User - Reader role
✕ Should verify app is launched and Sign In button is available (4ms)
✕ Should Sign In with valid AD user from a reader group (15ms)
✕ Should enter Settings View Page (2ms)
✕ Should Sign Out (1ms)
● Sign In using Enterprise AD User - Reader role › Should verify app is launched and Sign In button is available
DetoxRuntimeError: Failed to find a device by UDID = "7C50BE35-0CDE-413A-A08D-784E98C61010" and by type = "iPhone 11 Pro"
HINT: Run 'applesimutils --list' to list your supported devices. It is advised only to specify a device type, e.g., "iPhone Xʀ" and avoid explicit search by OS version.
at SimulatorDriver._queryDevices (../node_modules/detox/src/devices/drivers/SimulatorDriver.js:224:13)
● Sign In using Enterprise AD User - Reader role › Should verify app is launched and Sign In button is available
ReferenceError: device is not defined
7 | describe('Sign In using Enterprise AD User - Reader role', () => {
8 | beforeEach(async () => {
> 9 | await device.launchApp();
| ^
10 | });
11 |
12 | it('Should verify app is launched and Sign In button is available', async () => {
at device (specs/signinWithADUserTests.spec.js:9:11)
at tryCatch (../node_modules/#babel/runtime/node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (../node_modules/#babel/runtime/node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (../node_modules/#babel/runtime/node_modules/regenerator-runtime/runtime.js:97:21)
at tryCatch (../node_modules/#babel/runtime/node_modules/regenerator-runtime/runtime.js:45:40)
at invoke (../node_modules/#babel/runtime/node_modules/regenerator-runtime/runtime.js:135:20)
at ../node_modules/#babel/runtime/node_modules/regenerator-runtime/runtime.js:170:11
at callInvokeWithMethodAndArg (../node_modules/#babel/runtime/node_modules/regenerator-runtime/runtime.js:169:16)
at AsyncIterator.enqueue (../node_modules/#babel/runtime/node_modules/regenerator-runtime/runtime.js:192:13)
at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/#babel/runtime/node_modules/regenerator-runtime/runtime.js:97:21)
at Object.<anonymous>.exports.async (../node_modules/#babel/runtime/node_modules/regenerator-runtime/runtime.js:216:14)
at Object._callee (specs/signinWithADUserTests.spec.js:8:14)

As stated in the readme:
https://github.com/wix/AppleSimulatorUtils#troubleshooting
If Homebrew complains about a conflict in the wix/brew tap, run brew untap wix/brew && brew tap wix/brew and try installing again
Then upgrade applesimutils normally.

Related

Adjust protractor config to debug in non-headless mode

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.

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

when i run detox test,i get an error info

i'm running the demo in detox/example. but it can't run the demo normally.
i just run the following command:
1、npm install
2、npm run build:ios
3、npm run test:ios
i just got these error info in my console.
detox[30235] INFO: [DetoxServer.js] server listening on localhost:53335...
detox[30235] INFO: [AppleSimUtils.js] com.xxx.xxx.xxx.debug launched. To watch simulator logs, run:
/usr/bin/xcrun simctl spawn BE0CDB30-F235-41D2-BE85-488704F4A504 log stream --level debug --style compact --predicate 'processImagePath beginsWith "/Users/xxx/Library/Developer/CoreSimulator/Devices/BE0CDB30-F235-41D2-BE85-488704F4A504/data/Containers/Bundle/Application/460C7A3D-F8A1-4876-AFA9-3F227EEFDF64/xxx.app"'
1) "before all" hook in "{root}"
0 passing (2m)
1 failing
1) "before all" hook in "{root}":
Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
why did i get this error info? and what should i do to fix it ?

xcodebuild failed with code 65

When i try to launch App with Appium getting below error
[debug] [XCUITest] Error : Command 'bash -c "ps -ax|grep -i \"xcodebuild\"|grep -i \"faea4372d3a65bdb23969752f0d5902ca21c5571\"|grep -v grep|awk '{print \"kill -9 \" \$1}'|sh"' errored out: Error: spawn bash ENOENT
I've tried by adding Code_signing and team id with xcodeconfig capability but it is not working, could you please help me on this
Below are the capabilities set to
app: '/Users/arun/Documents/App/iOSAutomationTests/src/main/resources/test.ipa'
rotatable: true
newCommandTimeout: 120
realDeviceLogger: '/usr/local/lib/node_modules/deviceconsole'
platformVersion: '10.1.1'
automationName: 'XCUITest'
xcodeConfigFile: '/src/main/resources/myconfig.xcconfig'
platformName: 'iOS'
udid: 'faea4372d3a65bdb23969752f0d5902ca21c5571'
deviceName: 'faea4372d3a65bdb23969752f0d5902ca21c5571'
autoAcceptAlerts: true
Below is the log
XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: /usr/local/bin/carthage
[debug] [XCUITest] Killing hanging processes
[debug] [XCUITest] Error : Command 'bash -c "ps -ax|grep -i \"xcodebuild\"|grep -i \"faea4372d3a65bdbd7969752f0d5948ca21c5571\"|grep -v grep|awk '{print \"kill -9 \" \$1}'|sh"' errored out: Error: spawn bash ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
[debug] [XCUITest] Error : Command 'bash -c "ps -ax|grep -i \"/usr/local/lib/node_modules/deviceconsole\"|grep -i \"faea4372d3a65bdbd7969752f0d5948ca21c5571\"|grep -v grep|awk '{print \"kill -9 \" \$1}'|sh"' errored out: Error: spawn bash ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
[debug] [XCUITest] Error : Command 'bash -c "ps -ax|grep -i \"iproxy\"|grep -i \"faea4372d3a65bdbd7969752f0d5948ca21c5571\"|grep -v grep|awk '{print \"kill -9 \" \$1}'|sh"' errored out: Error: spawn bash ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
[XCUITest] Real device logger '/usr/local/lib/node_modules/deviceconsole' is a directory. Appending 'deviceconsole' executable
[debug] [XCUITest] Using real device logger '/usr/local/lib/node_modules/deviceconsole/deviceconsole'
[debug] [XCUITest] Using Xcode configuration file: '/src/main/resources/myconfig.xcconfig'
[debug] [XCUITest] Beginning test with command 'xcodebuild build test -project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=faea4372d3a65bdbd7969752f0d5948ca21c5571 -configuration Debug -xcconfig /src/main/resources/myconfig.xcconfig' in directory '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Waiting for WebDriverAgent to start on device
[debug] [XCUITest] Log file for xcodebuild test: /Users/arun.sambu/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/F08249A4-D6EB-4D3A-9354-0E638607CC28/Session-WebDriverAgentRunner-2017-02-03_142740-DZsDR7.log
[Xcode] 2017-02-03 14:27:41.093 xcodebuild[4292:81409] Error Domain=IDETestOperationsObserverErrorDomain Code=3 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/arun.sambu/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/F08249A4-D6EB-4D3A-9354-0E638607CC28/Session-WebDriverAgentRunner-2017-02-03_142740-DZsDR7.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/arun.sambu/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/F08249A4-D6EB-4D3A-9354-0E638607CC28/Session-WebDriverAgentRunner-2017-02-03_142740-DZsDR7.log}
[Xcode]
Testing failed:
./Scripts/generate_modules.sh: line 15: Modules/module.modulemap: No such file or directory
** TEST FAILED **
The following build commands failed:
PhaseScriptExecution Generate\ modules /Users/arun.sambu/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Intermediates/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentLib.build/Script-AD35D0281CF1B37A00870A75.sh
[Xcode] (1 failure)
Make sure your current user has write permissions to the folder where Appium is currently installed.
You can find some help here to change permission: https://apple.stackexchange.com/questions/16180/xcode-problem-with-directory-permissions
This issue is solved with Appium 1.6.3.
if you still face any issues, you can find the solution here:
https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md
Code 65 is the issue with code_signing,
If xcode config is not working for you, try manually signing WebDriverAgent in Xcode, that should do the trick, however I would suggest upgrading to 1.6.4, in which this issue has been resolved:
Allow for the auto-generation of the Xcode config file used to configurable
WDA before launch. This includes two new desired capabilities
xcodeOrgId - the Apple developer team identifier string
xcodeSigningId - a string representing a signing certificate, defaulting to
"iPhone Developer"
Below is the link:
https://github.com/appium/appium/releases

Appium crashes giving the error "Error getting source, can't continue finding element by XPath"

My appium version is 1.4.13. Xcode version is 7, iOS simulator version is 8.4.
Appium server crashes while trying to execute a command.
The same test used to work perfectly fine. Not sure why it is not working now.
I have also added the following command in my capabilities.
capabilities.setCapability("newCommandTimeout" , 60);
Appium log is pasted here.
info: [IOS_SYSLOG_ROW ] Jan 13 16:17:37 clones-MacBook-Pro-6.local DTMobileIS[7664]: Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn
info: [debug] Cleaning sim data files
info: node-simctl: Executing: xcrun with args: simctl erase 3C31DBE5-A0FD-4C5A-BAEC-C02DF76BFB36 and timeout: 2000
error: Error getting source, can't continue finding element by XPath
info: [debug] Cleaning app data files
warn: Applications directory /Users/Bindu/Library/Developer/CoreSimulator/Devices/3C31DBE5-A0FD-4C5A-BAEC-C02DF76BFB36/data/Containers/Data/Application doesn't exist. Have you run this simulator before?
warn: Applications directory /Users/Bindu/Library/Developer/CoreSimulator/Devices/3C31DBE5-A0FD-4C5A-BAEC-C02DF76BFB36/data/Containers/Bundle/Application doesn't exist. Have you run this simulator before?
info: Couldn't find app directories to delete. Probably it's not installed
info: [debug] We were in the middle of processing a command when instruments died; responding with a generic error
info: [debug] Cleaning up appium session
info: [debug] Condition unmet after 2355ms. Timing out.
info: [debug] Responding to client with error: {"status":13,"value":{"message":"Instruments died while responding to command, please check appium logs","name":"UnknownError","origValue":"Instruments died while responding to command, please check appium logs"},"sessionId":null}
info: <-- POST /wd/hub/session/07d24536-708f-4515-af69-a35d5695119e/element 500 2356.834 ms
Here is the code for running my tests:
public void completeSignUpForm() throws InterruptedException {
elementUtils.sendValueToElement(FIRSTNAME, "TestName");
elementUtils.sendValueToElement(LASTNAME, "TestSurname");
elementUtils.sendValueToElement(PASSWORD, "Drayson123");
elementUtils.clickElementByXpath(AGE);
elementUtils.enterDataIntoPickerWheel(AGE_PICKER_WHEEL, "26-35", 0);
elementUtils.clickElementByXpath(PICKER_WHEEL_DONE_BUTTON);
elementUtils.clickElementByXpath(GENDER);
elementUtils.enterDataIntoPickerWheel(GENDER_PICKER_WHEEL, "Female", 0);
elementUtils.clickElementByXpath(PICKER_WHEEL_DONE_BUTTON);
elementUtils.clickElementByXpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[9]/UIASwitch[1]");
Thread.sleep(3000);
elementUtils.clickElementByXpath(JOIN_US_BUTTON);
}
Support code for the methods from ElementUtils class are below:
public void sendValueToElement(String xpathSelector, String inputvalue) {
MobileElement element = (MobileElement) driver.findElementByXPath(xpathSelector);
element.setValue(inputvalue);
}
public void clickElementByXpath(String XpathSelector) {
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(XpathSelector)));
driver.findElement(By.xpath(XpathSelector)).click();
}
public void enterDataIntoPickerWheel(String xpathSelector, String text, int index) {
waitForElement(By.xpath(xpathSelector));
List<WebElement> we = driver.findElements(By.xpath(xpathSelector));
we.get(index).sendKeys(text);
}
Is the app working well without Appium in place. I meant install the App in Simulator and launch it and check if the app works fine.
If you see any issue then you have to fix it at that level. otherwise can you add full appium log.
To do so , you can do like below Link
To get the list of Simulators available in your system , you can type below command.Open Terminal and type below command
$ xcrun instruments -s
To launch Simulator using command line , you can type below command and provide same of simulator as you got from step 1 above
$ xcrun instruments -w "iPhone 6 (9.2)” // replace with your Simulator name
To install app on Simulator using command line once Simulator is up and running, you can type below command
$ xcrun simctl install booted <app path>
e.g.
$ xcrun simctl install booted /Users/macuser/Desktop/UIKitCatalog.app