why does Appium can't launch the app in android - appium

I run the following code in my python
But there is nothing happen on my android device. The appium don't launch any app on my android device. I have tried to use admin right to open appium desktop. And I also tried checked the "
Allow Session Override" on appium but still don't work.
I have also tried change the systemPort but still not work.
My appium version is 1.22.0
from appium import webdriver
desired_cap = {
"appium:deviceName": "BH9014465L",
"platformName": "Android",
"platformVersion": "8.0.0",
"appPackage ": 'net.xnano.android.ftpserver',
"appActivity": "net.xnano.android.ftpserver.MainActivity"
}
driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_cap)
The appium log:
Matched '/' to command name 'deleteSession'
[WD Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8399/wd/hub/session/b000d8ff-aaaa-4c13-b249-d2b4bc7644fb] with no body
[WD Proxy] Got response with status 200: {"sessionId":"b000d8ff-aaaa-4c13-b249-d2b4bc7644fb","value":null}
[Logcat] Stopping logcat capture
[ADB] Removing forwarded port socket connection: 8399
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L forward --remove tcp:8399'
[Appium] Applying relaxed security to 'AndroidUiautomator2Driver' as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure
[BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[BaseDriver] Creating session with W3C capabilities: {
[BaseDriver] "alwaysMatch": {
[BaseDriver] "platformName": "Android",
[BaseDriver] "appium:deviceName": "BH9014465L",
[BaseDriver] "appium:platformVersion": "8.0.0",
[BaseDriver] "appium:appPackage ": "net.xnano.android.ftpserver",
[BaseDriver] "appium:appActivity": "net.xnano.android.ftpserver.MainActivity"
[BaseDriver] },
[BaseDriver] "firstMatch": [
[BaseDriver] {}
[BaseDriver] ]
[BaseDriver] }
[BaseDriver] The following capabilities were provided, but are not recognized by Appium:
[BaseDriver] appPackage
[BaseDriver] Session created with session id: a6654c49-9424-48bf-a53d-bfc66dbd35c2
[UiAutomator2] Neither 'app' nor 'appPackage' was set. Starting UiAutomator2 without the target application
[ADB] Using 'adb.exe' from 'D:\android-sdk\platform-tools\adb.exe'
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 start-server'
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices
[ADB] Connected devices: [{"udid":"BH9014465L","state":"device"}]
[AndroidDriver] Looking for a device with Android '8.0.0'
[ADB] Setting device id to BH9014465L
[ADB] Getting device platform version
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell getprop ro.build.version.release'
[ADB] Current device property 'ro.build.version.release': 8.0.0
[AndroidDriver] Using device: BH9014465L
[ADB] Using 'adb.exe' from 'D:\android-sdk\platform-tools\adb.exe'
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 start-server'
[ADB] Setting device id to BH9014465L
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell getprop ro.build.version.sdk'
[ADB] Current device property 'ro.build.version.sdk': 26
[ADB] Device API level: 26
[AndroidDriver] No app sent in, not parsing package/activity
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L wait-for-device'
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell echo ping'
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell dumpsys package io.appium.settings'
[ADB] 'io.appium.settings' is installed
[ADB] Getting package info for 'io.appium.settings'
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell dumpsys package io.appium.settings'
[ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('3.4.0' >= '3.4.0')
[ADB] There is no need to install/upgrade 'C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell 'pgrep --help; echo $?''
[Instrumentation] .
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell 'pgrep ^appium\\.settings$ || pgrep ^io\\.appium\\.setti$''
[Instrumentation] Time: 432.589
[Instrumentation]
[Instrumentation] OK (1 test)
[Instrumentation] The process has exited with code 0
[AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell appops set io.appium.settings android:mock_location allow'
[Logcat] Starting logs capture with command: D:\\android-sdk\\platform-tools\\adb.exe -P 5037 -s BH9014465L logcat -v threadtime
[UiAutomator2] Forwarding UiAutomator2 Server port 6790 to local port 8200
[ADB] Forwarding system: 8200 to device: 6790
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L forward tcp:8200 tcp:6790'
[ADB] Getting install status for io.appium.uiautomator2.server
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell dumpsys package io.appium.uiautomator2.server'
[ADB] 'io.appium.uiautomator2.server' is installed
[ADB] Getting package info for 'io.appium.uiautomator2.server'
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell dumpsys package io.appium.uiautomator2.server'
[ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('4.24.0' >= '4.24.0')
[UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled
[ADB] Checking app cert for C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.24.0.apk
[ADB] Using the previously cached signature entry for 'appium-uiautomator2-server-v4.24.0.apk'
[ADB] sha256 hash did match for 'appium-uiautomator2-server-v4.24.0.apk'
[ADB] Getting install status for io.appium.uiautomator2.server.test
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell dumpsys package io.appium.uiautomator2.server.test'
[ADB] 'io.appium.uiautomator2.server.test' is installed
[ADB] Checking app cert for C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk
[ADB] Using the previously cached signature entry for 'appium-uiautomator2-server-debug-androidTest.apk'
[ADB] sha256 hash did match for 'appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Server packages are not going to be (re)installed
[UiAutomator2] Waiting up to 30000ms for services to be available
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell pm list instrumentation'
[UiAutomator2] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available
[ADB] Adding packages ["io.appium.settings","io.appium.uiautomator2.server","io.appium.uiautomator2.server.test"] to Doze whitelist
[ADB] Got the following command chunks to execute: [["dumpsys","deviceidle","whitelist","+io.appium.settings",";","dumpsys","deviceidle","whitelist","+io.appium.uiautomator2.server",";","dumpsys","deviceidle","whitelist","+io.appium.uiautomator2.server.test",";"]]
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server.test ;'
[UiAutomator2] No app capability. Assuming it is already on the device
[UiAutomator2] Performing shallow cleanup of automation leftovers
[UiAutomator2] No obsolete sessions have been detected (socket hang up)
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell am force-stop io.appium.uiautomator2.server.test'
[UiAutomator2] Starting UIAutomator2 server 4.24.0
[UiAutomator2] Using UIAutomator2 server from 'C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.24.0.apk' and test from 'C:\Program Files\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online...
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s","BH9014465L","shell","am","instrument","-w","-e","disableAnalytics",true,"io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8200/wd/hub/status] with no body
[WD Proxy] socket hang up
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8200/wd/hub/status] with no body
[WD Proxy] socket hang up
[Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8200/wd/hub/status] with no body
[WD Proxy] socket hang up
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8200/wd/hub/status] with no body
[WD Proxy] Got response with status 200: {"sessionId":"None","value":{"message":"UiAutomator2 Server is ready to accept commands","ready":true}}
[UiAutomator2] The initialization of the instrumentation process took 3242ms
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8200/wd/hub/session] with body: {"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","deviceName":"BH9014465L","platformVersion":"8.0.0","appPackage ":"net.xnano.android.ftpserver","appActivity":"net.xnano.android.ftpserver.MainActivity"},"platformName":"Android","deviceName":"BH9014465L","platformVersion":"8.0.0","appPackage ":"net.xnano.android.ftpserver","appActivity":"net.xnano.android.ftpserver.MainActivity","deviceUDID":"BH9014465L"}],"alwaysMatch":{}}}
[WD Proxy] Got response with status 200: {"sessionId":"f068b515-077d-4b9e-9657-b382034ef8d4","value":{"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","deviceName":"BH9014465L","platformVersion":"8.0.0","appPackage ":"net.xnano.android.ftpserver","appActivity":"net.xnano.android.ftpserver.MainActivity"},"platformName":"Android","deviceName":"BH9014465L","platformVersion":"8.0.0","appPackage ":"net.xnano.android.ftpserver","appActivity":"net.xnano.android.ftpserver.MainActivity","deviceUDID":"BH9014465L"}],"alwaysMatch":{}},"sessionId":"f068b515-077d-4b9e-9657-b382034ef8d4"}}
[WD Proxy] Determined the downstream protocol as 'W3C'
[WD Proxy] Proxying [GET /appium/device/info] to [GET http://127.0.0.1:8200/wd/hub/session/f068b515-077d-4b9e-9657-b382034ef8d4/appium/device/info] with no body
[WD Proxy] Got response with status 200: {"sessionId":"f068b515-077d-4b9e-9657-b382034ef8d4","value":{"androidId":"befd45229d2f8e0d","apiVersion":"26","bluetooth":{"state":"OFF"},"brand":"Sony","carrierName":"","displayDensity":480,"locale":"zh_HK","manufacturer":"Sony","model":"F5122","networks":[],"platformVersion":"8.0.0","realDisplaySize":"1080x1920","timeZone":"Asia/Hong_Kong"}}
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L shell dumpsys window'
[AndroidDriver] Screen already unlocked, doing nothing
[WD Proxy] Proxying [GET /appium/device/pixel_ratio] to [GET http://127.0.0.1:8200/wd/hub/session/f068b515-077d-4b9e-9657-b382034ef8d4/appium/device/pixel_ratio] with no body
[WD Proxy] Got response with status 200: {"sessionId":"f068b515-077d-4b9e-9657-b382034ef8d4","value":3}
[WD Proxy] Matched '/appium/device/system_bars' to command name 'getSystemBars'
[WD Proxy] Proxying [GET /appium/device/system_bars] to [GET http://127.0.0.1:8200/wd/hub/session/f068b515-077d-4b9e-9657-b382034ef8d4/appium/device/system_bars] with no body
[WD Proxy] Got response with status 200: {"sessionId":"f068b515-077d-4b9e-9657-b382034ef8d4","value":{"statusBar":72}}
[WD Proxy] Matched '/window/current/size' to command name 'getWindowSize'
[WD Proxy] Proxying [GET /window/current/size] to [GET http://127.0.0.1:8200/wd/hub/session/f068b515-077d-4b9e-9657-b382034ef8d4/window/current/size] with no body
[WD Proxy] Got response with status 200: {"sessionId":"f068b515-077d-4b9e-9657-b382034ef8d4","value":{"height":1776,"width":1080}}
[Appium] New AndroidUiautomator2Driver session created successfully, session a6654c49-9424-48bf-a53d-bfc66dbd35c2 added to master session list
[BaseDriver] Event 'newSessionStarted' logged at 1634375217171 (17:06:57 GMT+0800 (中國標準時間))
[W3C (a6654c49)] Cached the protocol value 'W3C' for the new session a6654c49-9424-48bf-a53d-bfc66dbd35c2
[W3C (a6654c49)] Responding to client with driver.createSession() result: {"capabilities":{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","deviceName":"BH9014465L","platformVersion":"8.0.0","appPackage ":"net.xnano.android.ftpserver","appActivity":"net.xnano.android.ftpserver.MainActivity"},"platformName":"Android","deviceName":"BH9014465L","platformVersion":"8.0.0","appPackage ":"net.xnano.android.ftpserver","appActivity":"net.xnano.android.ftpserver.MainActivity","deviceUDID":"BH9014465L","deviceApiLevel":26,"deviceScreenSize":"1080x1920","deviceScreenDensity":480,"deviceModel":"F5122","deviceManufacturer":"Sony","pixelRatio":3,"statBarHeight":72,"viewportRect":{"left":0,"top":72,"width":1080,"height":1704}}}
[HTTP] <-- POST /wd/hub/session 200 7408 ms - 890
[HTTP]
[BaseDriver] Shutting down because we waited 60 seconds for a command
[Appium] Closing session, cause was 'New Command Timeout of 60 seconds expired. Try customizing the timeout using the 'newCommandTimeout' desired capability'
[Appium] Removing session 'a6654c49-9424-48bf-a53d-bfc66dbd35c2' from our master session list
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[WD Proxy] Matched '/' to command name 'deleteSession'
[WD Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8200/wd/hub/session/f068b515-077d-4b9e-9657-b382034ef8d4] with no body
[WD Proxy] socket hang up
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up
[Logcat] Stopping logcat capture
[ADB] Removing forwarded port socket connection: 8200
[ADB] Running 'D:\android-sdk\platform-tools\adb.exe -P 5037 -s BH9014465L forward --remove tcp:8200'

I may be wrong but I am pretty sure that on appium python you can't use appPackage and appActivity, you have to use app and import a zip containing your app:
"app": "path/to/app.zip"
UPDATE: You can use .apk instead of .zip since they are technically the same.
Example: https://github.com/appium/python-client#usage

In the section Remote Path add : "/wd/hub"

Related

Connecting via TLS to OPENLDAP: Certificate not found

I have an OpenLDAP Docker instance from Osixia and am trying to query it securely from the client using TLS. The query works without encryption using $ ldapwhoami -H ldap://localhost -x and does not work when using the -ZZ flag to start TLS operation $ ldapwhoami -H ldap://localhost -x -ZZ - it returns ldap_start_tls: Can't contact LDAP server (-1). How can i make this work? Below are all the steps i took:
Run LDAP server in docker:
$ docker run -p 389:389 -p 636:636 --name ldap-service --hostname ldap-service \
--env LDAP_ADMIN_PASSWORD="password" --env LDAP_BASE_DN="dc=example,dc=org" --detach osixia/openldap:1.4.0
Test Connectivity - shows success, it returns anonymous
$ ldapwhoami -H ldap://localhost -x
anonymous
Preparations for TLS connectivity - Configure client to trust SERVER Certificate Authority (CA)
SERVER DOCKER CONTAINER: TLS certs are autoconfigured upon runtime in the osixia/openldap image. Copy contents of CA in /container/service/slapd/assets/certs/ca.crt
CLIENT: Paste the copied SERVER ca.crt into CLIENT folder /usr/local/share/ca-certificates/ca.crt , then run sudo update-ca-certificates to add it. Confirm success of adding by checking that the CA is inside /etc/ssl/certs/ca-certificates.crt
CLIENT: In file/etc/ldap/ldap.conf I added the line TLS_CACERT /etc/ssl/certs/ca-certificates.crt
Test TLS connectivity from CLIENT via -ZZ flag to start TLS operation:
$ ldapwhoami -H ldap://localhost -x -ZZ
ldap_start_tls: Can't contact LDAP server (-1)
additional info: The TLS connection was non-properly terminated.
Further logs from inside LDAP docker:
5ff42195 conn=1079 fd=12 ACCEPT from IP=172.17.0.1:39420 (IP=0.0.0.0:636)
TLS: can't accept: No certificate was found..
5ff42195 conn=1079 fd=12 closed (TLS negotiation failure)
Test TLS connectivity from CLIENT via LDAP Secure URI scheme ldaps://
$ ldapwhoami -H ldaps://localhost -x
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
Things i tried out:
I read through https://www.openldap.org/doc/admin24/tls.html and subsequently installed the Server CA on the client.
I read through this post: ldapsearch over ssl/tls doesn't work, I changed the settings in /etc/ldap/ldap.conf to include the below items, but to no avail.
TLS_CACERT /etc/ssl/certs/ca-certificates.crt
TLS_REQCERT ALLOW
PORT 636
HOST localhost // i also tried 'ldap-service'
I found the solution:
Add --env LDAP_TLS_VERIFY_CLIENT=try to the docker run command. Source
For Googlers,
Presto does not supply client certificates (client certificate verification, two-way verification) when connecting to LDAP service, so you will need --env LDAP_TLS_VERIFY_CLIENT=tryor never if you use osixia/openldap, or, edit ldap.conf and set TLS_REQCERT never and restart the LDAP service.

appium - XCUITest does not always start with error ECONNREFUSED

I am trying to run some appium tests on iOS and it seems about half the time the WebDriverAgent never starts up. I get this error over and over again in the appium logs:
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
After this happens for some time, I'll restart the server and try again. More often than not, I'll get that error a few times but then the WebDriverAgent server will start:
debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WebDriverAgent Log file for xcodebuild test: /Users/kroe761/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Logs/Test/Test-WebDriverAgentRunner-2020.10.15_11-20-17--0500.xcresult/Staging/2_Test/Diagnostics/WebDriverAgentRunner-27B846BD-B71B-4DA7-910B-ABEB46E5890F/WebDriverAgentRunner-7B63C34A-8F4F-4B67-AD6F-3F34C50C4DF1/Session-WebDriverAgentRunner-2020-10-15_112018-MRGyT7.log
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[debug] [simctl] WD Proxy Got response with status 200: {"value":{"message":"WebDriverAgent is ready to accept commands","state":"success","os":{"testmanagerdVersion":28,"name":"iOS","sdkVersion":"14.0","version":"14.0"},"ios":{"simulatorVersion":"14.0","ip":"172.21.99.125"},"ready":true,"build":{"upgradedAt":"1602686780985","time":"Oct 15 2020 10:58:44","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":null}
[debug] [simctl] WebDriverAgent WebDriverAgent information:
[debug] [simctl] WebDriverAgent {
[debug] [simctl] WebDriverAgent "message": "WebDriverAgent is ready to accept commands",
[debug] [simctl] WebDriverAgent "state": "success",
[debug] [simctl] WebDriverAgent "os": {
[debug] [simctl] WebDriverAgent "testmanagerdVersion": 28,
[debug] [simctl] WebDriverAgent "name": "iOS",
[debug] [simctl] WebDriverAgent "sdkVersion": "14.0",
[debug] [simctl] WebDriverAgent "version": "14.0"
[debug] [simctl] WebDriverAgent },
[debug] [simctl] WebDriverAgent "ios": {
[debug] [simctl] WebDriverAgent "simulatorVersion": "14.0",
[debug] [simctl] WebDriverAgent "ip": "172.xx.xx.xxx"
[debug] [simctl] WebDriverAgent },
[debug] [simctl] WebDriverAgent "ready": true,
[debug] [simctl] WebDriverAgent "build": {
[debug] [simctl] WebDriverAgent "upgradedAt": "1602686780985",
[debug] [simctl] WebDriverAgent "time": "Oct 15 2020 10:58:44",
[debug] [simctl] WebDriverAgent "productBundleIdentifier": "com.facebook.WebDriverAgentRunner"
[debug] [simctl] WebDriverAgent }
[debug] [simctl] WebDriverAgent }
[debug] [simctl] WebDriverAgent WebDriverAgent successfully started after 5889ms
[debug] [simctl] BaseDriver Event 'wdaSessionAttempted' logged at 1602778820361 (11:20:20 GMT-0500 (Central Daylight Time))
[debug] [simctl] XCUITest Sending createSession command to WDA
[debug] [simctl] WD Proxy Matched '/session' to command name 'createSession'
I absolutely hate issues where "this sometimes happens" but I've been digging into this for days and have no answer. Any help would be appreciated!
Edit: Here are my caps:
caps = {
platformName: :ios,
deviceName: "iPhone 11",
automationName: "XCUITest",
app: "/path/to/app",
sendKeyStrategy: "setValue",
showXcodeLog: true,
useNewWDA: true
}
Even though this is Tosca documentation, this might also be very helpful in explaining why #Vault23 might be right with his hint to use
useNewWDA: true and usePrebuiltWDA: true
https://documentation.tricentis.com/tosca/1340/en/content/engines_3.0/mobile/tbox_mobileweb_set_appium_capabilities.htm
Adding above two capabilities mad my local mobile tests using Appium and local simulator of an iPhone much more stable and repeatable. Though I must admit, I do not understand why.

Error with terraform init in a docker container -- x509: certificate signed by unknown authority

I have
$ cat terraform.Dockerfile
FROM alpine
MAINTAINER Carlos Nunez <dev#carlosnunez.me>
RUN wget -O /tmp/terraform.zip https://releases.hashicorp.com/terraform/0.12.9/terraform_0.12.9_linux_amd64.zip && \
unzip /tmp/terraform.zip -d /
RUN apk update && apk add --no-cache ca-certificates curl
USER nobody
When I do
$ docker-compose run terraform /terraform init
I get
$ docker-compose run terraform /terraform init
2020/03/29 08:25:36 [INFO] Terraform version: 0.12.9
2020/03/29 08:25:36 [INFO] Go runtime version: go1.12.9
2020/03/29 08:25:36 [INFO] CLI args: []string{"/terraform", "init"}
2020/03/29 08:25:36 [DEBUG] Attempting to open CLI config file: /.terraformrc
2020/03/29 08:25:36 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/03/29 08:25:36 [INFO] CLI command args: []string{"init"}
2020/03/29 08:25:36 [ERR] Checkpoint error: mkdir /.terraform.d: permission denied
Initializing the backend...
2020/03/29 08:25:36 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/03/29 08:25:36 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/03/29 08:25:36 [DEBUG] New state was assigned lineage "cff52927-0e9b-8ef4-8aeb-2b176dbc40a6"
2020/03/29 08:25:36 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
2020/03/29 08:25:36 [TRACE] Meta.Backend: instantiated backend of type <nil>
2020/03/29 08:25:36 [DEBUG] checking for provider in "."
2020/03/29 08:25:36 [DEBUG] checking for provider in "/"
2020/03/29 08:25:36 [DEBUG] checking for provisioner in "."
2020/03/29 08:25:36 [DEBUG] checking for provisioner in "/"
2020/03/29 08:25:36 [INFO] Failed to read plugin lock file .terraform/plugins/linux_amd64/lock.json: open .terraform/plugins/linux_amd64/lock.json: no such file or directory
2020/03/29 08:25:36 [TRACE] Meta.Backend: backend <nil> does not support operations, so wrapping it in a local backend
2020/03/29 08:25:36 [TRACE] backend/local: state manager for workspace "default" will:
- read initial snapshot from terraform.tfstate
- write new snapshots to terraform.tfstate
- create any backup at terraform.tfstate.backup
2020/03/29 08:25:36 [TRACE] statemgr.Filesystem: reading initial snapshot from terraform.tfstate
2020/03/29 08:25:36 [TRACE] statemgr.Filesystem: snapshot file has nil snapshot, but that's okay
2020/03/29 08:25:36 [TRACE] statemgr.Filesystem: read nil snapshot
2020/03/29 08:25:36 [DEBUG] checking for provider in "."
2020/03/29 08:25:36 [DEBUG] checking for provider in "/"
2020/03/29 08:25:36 [DEBUG] plugin requirements: "aws"=""
2020/03/29 08:25:36 [DEBUG] Service discovery for registry.terraform.io at https://registry.terraform.io/.well-known/terraform.json
2020/03/29 08:25:36 [TRACE] HTTP client GET request to https://registry.terraform.io/.well-known/terraform.json
Initializing provider plugins...
- Checking for available provider plugins...
2020/03/29 08:25:36 [DEBUG] Failed to request discovery document: Get https://registry.terraform.io/.well-known/terraform.json: x509: certificate signed by unknown authority
Registry service unreachable.
This may indicate a network issue, or an issue with the requested Terraform Registry.
Error: registry service is unreachable, check https://status.hashicorp.com/ for status updates
I saw several links online indicating same/similar error that was solved by installing curl.
I have curl on the container, I verified it.
$ docker-compose run terraform curl --version
curl 7.67.0 (x86_64-alpine-linux-musl) libcurl/7.67.0 OpenSSL/1.1.1d zlib/1.2.11 nghttp2/1.40.0
Release-Date: 2019-11-06
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets
I also have the certificates installed:
$ docker-compose run terraform ls -lR /etc/ssl
Here is output of curl -v
$ docker-compose run --entrypoint 'curl -v --insecure https://registry.terraform.io/.well-known/terraform.json' terraform
* Trying 151.101.190.49:443...
* TCP_NODELAY set
* Connected to registry.terraform.io (151.101.190.49) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: C=US; ST=California; L=San Francisco; O=Fastly, Inc.; CN=q2.shared.global.fastly.net
* start date: Apr 1 14:48:12 2020 GMT
* expire date: Aug 29 17:17:53 2020 GMT
* issuer: C=US; ST=CA; O=paloalto networks; OU=IT; CN=decrypt.paloaltonetworks.com
* SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x55cce9444220)
> GET /.well-known/terraform.json HTTP/2
> Host: registry.terraform.io
> user-agent: curl/7.67.0
> accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 200
< server: Cowboy
< cache-control: stale-if-error=31536000, public, max-age=3600
< content-security-policy: default-src 'self'; script-src 'self' 'unsafe-inline' https://www.google-analytics.com https://cdn.segment.com https://www.googletagmanager.com https://a.optnmstr.com; style-src 'self' 'unsafe-inline' https://maxcdn.bootstrapcdn.com https://fonts.googleapis.com https://p.typekit.net https://use.typekit.net; img-src 'self' data: https: https://www.google-analytics.com; font-src 'self' https://maxcdn.bootstrapcdn.com https://fonts.googleapis.com https://fonts.gstatic.com https://use.typekit.net; connect-src 'self' https://www.google-analytics.com https://api.segment.io https://sentry.io https://api.omappapi.com https://api.opmnstr.com https://api.optmnstr.com
< content-type: application/json
< feature-policy:
< last-modified: Fri, 10 Apr 2020 08:49:04 GMT
< referrer-policy: no-referrer-when-downgrade
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
< x-frame-options: DENY
< x-xss-protection: 1; mode=block
< via: 1.1 vegur
< via: 1.1 varnish
< accept-ranges: bytes
< date: Sat, 11 Apr 2020 06:07:54 GMT
< via: 1.1 varnish
< age: 63
< x-served-by: cache-dca17758-DCA, cache-pao17436-PAO
< x-cache: HIT, HIT
< x-cache-hits: 1, 1
< vary: Accept-Encoding
< content-length: 62
<
{"modules.v1":"/v1/modules/","providers.v1":"/v1/providers/"}
* Connection #0 to host registry.terraform.io left intact
Run update-ca-certificates after you instal the ca-certificates package. Docker layer caching may prevent it from re-running the install step, and the CA Certificates are likely out of date.
Running update-ca-certificates didnt work for me. I tried below method of mapping node's cert file copy to container's cert file and it worked.
try to check if the node on which docker container is installed is able to connect to terraform.
Do "curl -v https://registry.terraform.io/.well-known/terraform.json" on both, docker node as well as container.
If node's curl works and container's fails, then try to create copy of the cert file. Cert file location can be fetched from curl command output as below.
After creating copy map this certificates file to container's certificate file (location for which you will get in container's curl command).
If your both of our curl fails try updating your certificate and then try above method.
link for image containing curl cmd output and the certificate location in the request header

openconnect in dockers/IBM bluemix (Error: TUNSETIFF failed: Inappropriate ioctl for device)

I've created my own container image based on Ubuntu 14.04 and installed openconnect using apt-get. I can ping google, and access the app I have running on the port I expect.
Now I am trying to get a VPN connection from the container to a on-prem database. I've tried it in my Ubuntu 14.04 virtual box first without a problem. See below for details. I am now trying to do the same in the container, but get the following error (see below for full log):
TUNSETIFF failed: Inappropriate ioctl for device
Things that I found:
Source: https://serverfault.com/questions/379710/openvpn-setup-service-wont-start
"What type of VPS do you have? You may need your provider to enable TUN/TAP devices on the host node."
-> Given that it works on my laptop in the exact same way, I assume that has been enabled on the host.
Source: https://groups.google.com/forum/#!topic/docker-user/2jFeDGJj36E
Do I have a tun device?
-> It is there with all the appropriate rights
Source: https://serverfault.com/questions/680721/how-to-create-dev-tun-device-inside-unprivileged-lxc-container
and
Source: https://hub.docker.com/r/dperson/openvpn-client/
Maybe I should add some flags?
cf ic run --device /dev/net/tun --cap-drop ALL --cap-add MKNOD --name <containerName> -p 11821:11821 -d <namespace>/<containerName python /<some pythong script>&
I also tried without cap-drop, without --device, using --cap-add ALL, using cap-add SYS_NET_ADMIN, with the same result, 1 extra error line:
mknod: '/dev/net/tun': Operation not permitted
TUNSETIFF failed: Inappropriate ioctl for device
Running with --privileged is not allowed in Bluemix
Anybody any pointers? Is there any other information is should provide? Thanks!
Succesfull
enter code here
$ sudo openconnect -u <username> <vpn IP>
POST <vpn IP>
Attempting to connect to server <IP>
SSL negotiation with <vpn IP>
Connected to HTTPS on <vpn IP>
XML POST enabled
Please enter your username and password.
Password:
POST <vpn IP>
Got CONNECT response: HTTP/1.1 200 OK
CSTP connected. DPD 30, Keepalive 20
Connected tun0 as 10.x.x.x, using SSL
Established DTLS connection (using OpenSSL)
From container
$openconnect -u <username> <vpn IP>
POST <vpn IP>
Attempting to connect to server <ip>
SSL negotiation with <vpn IP>
Connected to HTTPS on <vpn IP>
XML POST enabled
Pleas e enter your username and password.
Password:
POST <vpn IP>
Got CONNECT response: HTTP/1.1 200 OK
CSTP connected. DPD 30, Keepalive 20
TUNSETIFF failed: Inappropriate ioctl for device
Unfortunately, you would probably have to be able to run the container with the --privileged or --cap-add flags, which are not supported on IBM Containers

cURL cannot connect to localhost but browser can

I'm running a Rails app locally (Thin server), and I can connect locally from the browser (localhost:3000), but when I try to use curl, I get:
curl -H 'id:1' -i 'http://localhost:3000/api/data' -v
* Hostname was NOT found in DNS cache
* Trying ::1...
* Adding handle: conn: 0x7fd121808200
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fd121808200) send_pipe: 1, recv_pipe: 0
* Connection failed
* connect to ::1 port 3000 failed: Connection refused
* Trying fe80::1...
* Connection failed
* connect to fe80::1 port 3000 failed: Connection refused
* Failed to connect to localhost port 3000: Connection refused
* Closing connection 0
curl: (7) Failed to connect to localhost port 3000: Connection refused
This used to work just fine, but I recently updated to Mavericks, which I suspect may have broken something. I can also curl successfully from the web.
This is a curl bug (a strange one), where curl fails to fall back to IPv4 if there's an IPv6 entry in /etc/hosts that doesn't respond.
You can force it to use IPv4 via the -4 option.
Instead of
curl localhost:3000
try
curl 0.0.0.0:3000
It works.
If it doesn't, check the output when you start your rails server:
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-10-28 15:30:08] INFO WEBrick 1.3.1
[2014-10-28 15:30:08] INFO ruby 2.0.0 (2014-02-24) [x86_64-darwin12.5.0]
[2014-10-28 15:30:08] INFO WEBrick::HTTPServer#start: pid=4004 port=3000
Use the url at the end of line 2 instead of ENV['HOST']
Are you behind a proxy? Then use the below to bypass the proxy altogether.
curl -x "" "http://127.0.0.1:3000"
Assuming that you have not touched /etc/hosts and scutil reports are positive:
$ scutil -r 127.0.0.1
Reachable,Local Address
$ scutil -r localhost
Reachable,Local Address
then my guess is that the Firewall is active and not accepting connections from curl.
Try adding curl to the list accepted applications under (I'm guessing at the language alternatives since my machine is set to use Swedish) Preference --> Security --> Firewall alternatives --> plus sign --> (serach for curl and add it)
Note: make sure that you add the curl that you are actually using in your shell.
$ type -a curl
curl is /opt/local/bin/curl
curl is /usr/bin/curl
Another cause of this issue can be a poorly configured system with a proxy address. Run
export http_proxy=
and rerun the curl command, to eliminate this as a contributing factor. It fixed this issue for me.
Restarting the computer can sometimes fix odd connection issues. I'm not sure why.

Resources