Environment
Appium : 1.6.4
OS : Ubuntu 16.04 64bit
Node.js : 7.9.0
Android : 5.1
Device :1501-M02
API :java
Appium CLI
Details
I am using spock as test framework,with blow code:
class Test{
AndroidDriver<RemoteWebElement> driver;
DesiredCapabilities cap=DesiredCapabilities.android();
........
def setup(){
//setup driver
.....
cap.setCapability(NO_RESET, "true");
cap.setCapability(FULL_RESET, "false");
.....
cap.setCapability(RECREATE_CHROME_DRIVER_SESSIONS, "true");
.......
driver.context("WEBVIEW_com.domain.pkg");
}
def "test1"(){}
def "test2"(){}
def cleanup(){
driver.resetApp();
}
}
In eclipse,If right clicking test1 or test2->run as->junit test,both two run as expected,but if right clicking Test(class)->run as->junit test,the first test works,and the second test will throw exception:
org.openqa.selenium.WebDriverException: chrome not reachable
(Session info: webview=39.0.0.0)
(Driver info: chromedriver=2.28.455506
if replacing cleanup() with this:
def cleanup(){
driver.quit();
}
all works as expected,but each test will reinitialize a lot of staff which wastes huge time,
so
driver.resetApp()
not work as expected,is this a bug or do I do something wrong?
appium log like this:
[debug] [ADB] Running '/opt/android-sdk/platform-tools/adb' with args: ["-P",5037,"-s","MB8DW44999999999","shell","am","force-stop","com.vsi.pd.doctor"]
[debug] [MJSONWP] Responding to client with driver.closeApp() result: null
[HTTP] <-- POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/appium/app/close 200 1099 ms - 76
[HTTP] --> POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/appium/app/launch {}
[debug] [MJSONWP] Calling AppiumDriver.launchApp() with args: ["ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2"]
[AndroidDriver] No app sent in, not parsing package/activity
[debug] [AndroidDriver] No app capability. Assuming it is already on the device
[debug] [ADB] Device API level: 22
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/opt/android-sdk/platform-tools/adb' with args: ["-P",5037,"-s","MB8DW44999999999","shell","am","start","-W","-n","com.vsi.pd.doctor/.MainActivity","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[debug] [MJSONWP] Responding to client with driver.launchApp() result: null
[HTTP] <-- POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/appium/app/launch 200 1987 ms - 76
[HTTP] --> POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/context {"name":"WEBVIEW_com.vsi.pd.doctor"}
[debug] [MJSONWP] Calling AppiumDriver.setContext() with args: ["WEBVIEW_com.vsi.pd.doctor","ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2"]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/opt/android-sdk/platform-tools/adb' with args: ["-P",5037,"-s","MB8DW44999999999","shell","cat","/proc/net/unix"]
[debug] [AndroidDriver] WEBVIEW_17929 mapped to pid 17929
[debug] [AndroidDriver] Getting process name for webview
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/opt/android-sdk/platform-tools/adb' with args: ["-P",5037,"-s","MB8DW44999999999","shell","ps"]
[debug] [AndroidDriver] Parsed pid: 17929 pkg: com.vsi.pd.doctor!
[debug] [AndroidDriver] from: u0_a181,17929,274,1666480,109536,ffffffff,00000000,S,com.vsi.pd.doctor
[debug] [AndroidDriver] returning process name: com.vsi.pd.doctor
[debug] [AndroidDriver] Found webviews: ["WEBVIEW_com.vsi.pd.doctor"]
[debug] [AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.vsi.pd.doctor"]
[debug] [MJSONWP] Responding to client with driver.setContext() result: null
[HTTP] <-- POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/context 200 117 ms - 76
[HTTP] --> POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/element {"using":"id","value":"login"}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/element] to [POST http://127.0.0.1:8000/wd/hub/session/eb87d1b86ef6331102013b50ee2c0ea4/element] with body: {"using":"id","value":"login"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"eb87d1b86ef6331102013b50ee2c0ea4","status":100,"value":{"message":**"chrome not reachable**\n (Session info: webview=39.0.0.0)\n (Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 4.4.0-75-generic x86_64)"}}
[JSONWP Proxy] Replacing sessionId eb87d1b86ef6331102013b50ee2c0ea4 with ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2
[HTTP] <-- POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/element 200 13 ms - 269
[HTTP] --> POST /wd/hub/session/ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2/appium/app/close {}
[debug] [MJSONWP] Calling AppiumDriver.closeApp() with args: ["ebe4a8b1-844c-49f3-9997-9bc1bc0dd8a2"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/opt/android-sdk/platform-tools/adb' with args: ["-P",5037,"-s","MB8DW44999999999","shell","am","force-stop","com.vsi.pd.doctor"]
[debug] [MJSONWP] Responding to client with driver.closeApp() result: null
With new UIautomator you don't need to switch your driver to webview. It has built in capabilities to identify the elements inside webView.
Please update your Android SDK once.
Elements inside WebView will be visible in UIAutomator for Android Version 6.0+ versions. However, once you automate the script for Android 6.0+ device, you can use the same script for Android version below 6.0.
And also you can see the elements inside webView on Android 6.0+ devices using UIAutomator.
Related
Unable to switch to web view context in Appium v2.0.0-beta.46 and v2.0.0-beta.47
Same code working fine in Appium v1.22.3
Error:
Got response with status 500: {"value":{"error":"disconnected","message":"disconnected: unable to connect to renderer\n (failed to check if window was closed: disconnected: unable to connect to renderer
Code:
//Driver details
capability.setCapability("device", aDevice);
capability.setCapability("newCommandTimeout", 100000);
capability.setCapability("platformName", platform);
capability.setCapability("udid", aUdid);
capability.setCapability("appPackage", appPkg);
capability.setCapability("appActivity", appAct);
capability.setCapability("automationName", "UiAutomator2");
capability.setCapability("setWebContentsDebuggingEnabled", true);
AppiumDriver driver = new AndroidDriver(new URL(serverUrl), capability);
Set<String> contexts = ((SupportsContextSwitching) driver()).getContextHandles();
System.out.println("CONTEXT="+contexts); //prints CONTEXT=[NATIVE_APP, WEBVIEW_chrome]
for (String context : contexts) {
if (context.contains("WEBVIEW")) {
((SupportsContextSwitching) driver()).context(context);
break;
}
}
Exceptions:
io.appium.java_client.NoSuchContextException: An unknown server-side error occurred while processing the command. Original error: An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
(failed to check if window was closed: disconnected: unable to connect to renderer)
(Session info: chrome=108.0.5359.79)
Build info: version: '4.6.0', revision: '79f1c02ae20'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.6', java.version: '11.0.10'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [0b2b612b-473a-456b-a281-842d6e138aa9, switchToContext {name=WEBVIEW_chrome}]
Capabilities {appium:appActivity: com.tech.service..., appium:appPackage: com.tech.service..., appium:applicationCacheEnabled: false, appium:automationName: UIAutomator2, appium:databaseEnabled: false, appium:desired: {appActivity: com.tech.service..., appPackage: com.tech.service..., applicationCacheEnabled: false, automationName: UIAutomator2, device: Pixel 6, newCommandTimeout: 100000, platformName: android, setWebContentsDebuggingEnabled: true, udid: RXCABCD}, appium:device: Pixel 6, appium:deviceApiLevel: 31, appium:deviceManufacturer: samsung, appium:deviceModel: SM-G770F, appium:deviceName: RXCABCD, appium:deviceScreenDensity: 420, appium:deviceScreenSize: 1080x2400, appium:deviceUDID: RXCABCD, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 100000, appium:pixelRatio: 2.625, appium:platformVersion: 12, appium:setWebContentsDebuggingEnabled: true, appium:statBarHeight: 90, appium:takesScreenshot: true, appium:udid: RXCABCD, appium:viewportRect: {height: 2091, left: 0, top: 90, width: 1080}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID}
Session ID: 0b2b612b-473a-456b-a281-842d6e138aa9
Appium Logs:
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD shell cat /proc/net/unix'
[debug] [AndroidDriver] Parsed 1 active devtools socket: ["#chrome_devtools_remote"]
[debug] [AndroidDriver] Collecting CDP data of 1 webview
[debug] [AndroidDriver] Forwarding remote port chrome_devtools_remote to a local port in range 10900..11000
[debug] [AndroidDriver] You could use the 'webviewDevtoolsPort' capability to customize the starting port number
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD forward tcp:10900 localabstract:chrome_devtools_remote'
[debug] [ADB] Removing forwarded port socket connection: 10900
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD forward --remove tcp:10900'
[debug] [AndroidDriver] CDP data collection completed
[debug] [AndroidDriver] Found 1 webview: ["WEBVIEW_chrome"]
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] Available contexts: ["NATIVE_APP","WEBVIEW_chrome"]
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] Connecting to chrome-backed webview context 'WEBVIEW_chrome'
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] Identified chromeAndroidPackage as 'com.android.chrome' for context 'WEBVIEW_chrome' by CDP
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] A port was not given, using random free port: 8000
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] Passing web view details to the Chromedriver constructor: {
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "info": {
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "Android-Package": "com.android.chrome",
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "Browser": "Chrome/108.0.5359.79",
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "Protocol-Version": "1.3",
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "User-Agent": "Mozilla/5.0 (Linux; Android 12; SM-G770F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36",
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "V8-Version": "10.8.168.21",
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "WebKit-Version": "537.36 (#5194e1e1073e30a8fc93c72c2aee4bc572f5b07a)",
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "webSocketDebuggerUrl": "ws://127.0.0.1:10900/devtools/browser"
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] },
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "process": {
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "name": "chrome",
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] "id": null
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] }
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] }
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] Automated Chromedriver download is disabled. Use 'chromedriver_autodownload' server feature to enable it
[debug] [AndroidDriver] Precalculated Chromedriver capabilities: {
[debug] [AndroidDriver] "androidPackage": "com.android.chrome",
[debug] [AndroidDriver] "androidUseRunningApp": true,
[debug] [AndroidDriver] "androidDeviceSerial": "RXCABCD"
[debug] [AndroidDriver] }
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] Before starting chromedriver, androidPackage is 'com.android.chrome'
[debug] [Chromedriver#4fe7] Changed state to 'starting'
[debug] [Chromedriver#4fe7] Using the static Chromedriver->Chrome mapping
[debug] [Chromedriver#4fe7] The most recent known Chrome version: 108.0.5359
[debug] [Chromedriver#4fe7] Found 1 executable in '/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac'
[debug] [Chromedriver#4fe7] The following Chromedriver executables were found:
[debug] [Chromedriver#4fe7] '/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71' (version '108.0.5359.71', minimum Chrome version '108.0.5359')
[debug] [Chromedriver#4fe7] Browser version in the supplied details: Chrome/108.0.5359.79
[debug] [Chromedriver#4fe7] Found Chrome bundle 'undefined' version '108.0.5359'
[debug] [Chromedriver#4fe7] Found 1 executable capable of automating Chrome '108.0.5359'.
[debug] [Chromedriver#4fe7] Choosing the most recent, '/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71'.
[debug] [Chromedriver#4fe7] If a specific version is required, specify it with the chromedriverExecutabledesired capability.
[Chromedriver#4fe7] Set chromedriver binary as: /Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71
[debug] [Chromedriver#4fe7] Killing any old chromedrivers, running: pkill -15 -f "/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71.*--port=8000"
[Chromedriver#4fe7] No old chromedrivers seem to exist
[debug] [Chromedriver#4fe7] Cleaning this device's adb forwarded port socket connections: RXCABCD
[debug] [ADB] List forwarding ports
[debug] [ADB] Running '/Users/tech/Library/Android/sdk/platform-tools/adb -P 5037 -s RXCABCD forward --list'
[Chromedriver#4fe7] Spawning chromedriver with: /Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/chromedriver/mac/chromedriver_mac64_v108.0.5359.71 --port=8000 --adb-port=5037 --verbose
[debug] [Chromedriver#4fe7] Chromedriver version: '108.0.5359.71'
[debug] [Chromedriver#4fe7] Matched '/status' to command name 'getStatus'
[debug] [Chromedriver#4fe7] Proxying [GET /status] to [GET http://127.0.0.1:8000/status] with no body
[debug] [Chromedriver#4fe7] Got response with status 200: {"value":{"build":{"version":"108.0.5359.71 (1e0e3868ee06e91ad636a874420e3ca3ae3756ac-refs/branch-heads/5359#{#1016})"},"message":"ChromeDriver ready for new sessions.","os":{"arch":"x86_64","name":"Mac OS X","version":"12.6.0"},"ready":true}}
[Chromedriver#4fe7] Starting W3C Chromedriver session with capabilities: {
[Chromedriver#4fe7] "capabilities": {
[Chromedriver#4fe7] "alwaysMatch": {
[Chromedriver#4fe7] "goog:chromeOptions": {
[Chromedriver#4fe7] "androidPackage": "com.android.chrome",
[Chromedriver#4fe7] "androidUseRunningApp": true,
[Chromedriver#4fe7] "androidDeviceSerial": "RXCABCD"
[Chromedriver#4fe7] },
[Chromedriver#4fe7] "goog:loggingPrefs": {
[Chromedriver#4fe7] "browser": "ALL"
[Chromedriver#4fe7] }
[Chromedriver#4fe7] }
[Chromedriver#4fe7] }
[Chromedriver#4fe7] }
[debug] [Chromedriver#4fe7] Matched '/session' to command name 'createSession'
[debug] [Chromedriver#4fe7] Proxying [POST /session] to [POST http://127.0.0.1:8000/session] with body: {"capabilities":{"alwaysMatch":{"goog:chromeOptions":{"androidPackage":"com.android.chrome","androidUseRunningApp":true,"androidDeviceSerial":"RXCABCD"},"goog:loggingPrefs":{"browser":"ALL"}}}}
[debug] [Chromedriver#4fe7] Webview version: 'Chrome/108.0.5359.79'
[Chromedriver#4fe7] Got response with status 500: {"value":{"error":"disconnected","message":"disconnected: unable to connect to renderer\n (failed to check if window was closed: disconnected: unable to connect to renderer)\n (Session info: chrome=108.0.5359.79)","stacktrace":"0 chromedriver_mac64_v108.0.5359.71 0x0000000101a45f38 chromedriver_mac64_v108.0.5359.71 + 4910904\n1 chromedriver_mac64_v108.0.5359.71 0x00000001019c5a03 chromedriver_mac64_v108.0.5359.71 + 4385283\n2 chromedriver_mac64_v108.0.5359.71 0x000000010160a747 chromedriver_mac64_v108.0.5359.71 + 472903\n3 chromedriver_mac64_v108.0.5359.71 0x00000001015ef7ea chromedriver_mac64_v108.0.5359.71 + 362474\n4 chromedriver_mac64_v108.0.5359.71 0x00000001015dee19 chromedriver_mac64_v108.0.5359.71 + 294425\n5 chromedriver_mac64_v108.0.5359.71 0x00000001015de9f5 chromedriver_mac64_v108.0.5359.71 + 293365\n6 chromedriver_mac64_v108.0.5359.71 0x000000010167e578 chromedriver_mac64_v108.0.5359.71 + 947576\n7 chromedriver_mac64_v108.0.5359.71 0x000000010167dcbf chromedri...
[debug] [W3C] Matched W3C error code 'disconnected' to UnknownError
[debug] [Chromedriver#4fe7] UnknownError: An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
[debug] [Chromedriver#4fe7] (failed to check if window was closed: disconnected: unable to connect to renderer)
[debug] [Chromedriver#4fe7] (Session info: chrome=108.0.5359.79)
[debug] [Chromedriver#4fe7] at errorFromW3CJsonCode (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/#appium/base-driver/lib/protocol/errors.js:928:23)
[debug] [Chromedriver#4fe7] at ProxyRequestError.getActualError (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/#appium/base-driver/lib/protocol/errors.js:798:14)
[debug] [Chromedriver#4fe7] at JWProxy.command (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/#appium/base-driver/lib/jsonwp-proxy/proxy.js:340:19)
[debug] [Chromedriver#4fe7] at processTicksAndRejections (node:internal/process/task_queues:95:5)
[debug] [Chromedriver#4fe7] at Chromedriver.startSession (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:597:5)
[debug] [Chromedriver#4fe7] at Chromedriver.start (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:528:7)
[debug] [Chromedriver#4fe7] at AndroidUiautomator2Driver.setupNewChromedriver (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:471:3)
[debug] [Chromedriver#4fe7] at AndroidUiautomator2Driver.startChromedriverProxy (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:217:10)
[debug] [Chromedriver#4fe7] at AndroidUiautomator2Driver.switchContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:124:5)
[debug] [Chromedriver#4fe7] at AndroidUiautomator2Driver.setContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:51:3)
[Chromedriver#4fe7] Chromedriver exited unexpectedly with code null, signal SIGTERM
[debug] [Chromedriver#4fe7] Changed state to 'stopped'
[Chromedriver#4fe7] An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
[Chromedriver#4fe7] (failed to check if window was closed: disconnected: unable to connect to renderer)
[Chromedriver#4fe7] (Session info: chrome=108.0.5359.79)
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] Encountered internal error running command: Error: An unknown server-side error occurred while processing the command. Original error: disconnected: unable to connect to renderer
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] (failed to check if window was closed: disconnected: unable to connect to renderer)
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] (Session info: chrome=108.0.5359.79)
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] at Object.errorAndThrow (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/#appium/support/lib/logging.js:115:34)
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] at Chromedriver.start (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-chromedriver/lib/chromedriver.js:553:16)
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] at AndroidUiautomator2Driver.setupNewChromedriver (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:471:3)
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] at AndroidUiautomator2Driver.startChromedriverProxy (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:217:10)
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] at AndroidUiautomator2Driver.switchContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:124:5)
[debug] [AndroidUiautomator2Driver#20f3 (0b2b612b)] at AndroidUiautomator2Driver.setContext (/Users/tech/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/context.js:51:3)
[HTTP] <-- POST /wd/hub/session/0b2b612b-473a-456b-a281-842d6e138aa9/context 500 720 ms - 1008
I am running a processone/ejabberd container that i am trying to get to request a certificate via ACME to a smallstep ca container. The request fails with this error:
#{<<"kid">> =>
<<"https://ca.mydomain.local:8000/acme/acme/account/svUkT7QwXD4pBqyrVdys94VMeVCeeo0D">>,
<<"nonce">> =>
<<"..">>,
<<"url">> =>
<<"https://ca.mydomain.local:8000/acme/acme/certificate/Jks2zJjdJwqDzE7VSsLM0TOaAzzYUB2P">>}}
2022-11-07 08:30:28.355858+00:00 [debug] HTTP request: {post,{"https://ca.mydomain.local:8000/acme/acme/certificate/Jks2zJjdJwqDzE7VSsLM0TOaAzzYUB2P",
[],"application/jose+json",
<<"{\"signature\":\"....\",\"protected\":\"......\",\"payload\":\"\"}">>}}
2022-11-07 08:30:28.608072+00:00 [debug] HTTP response: {{"HTTP/1.1",200,"OK"},
[{"cache-control","no-store"},
{"date","Mon, 07 Nov 2022 08:30:28 GMT"},
{"content-length","2108"},
{"content-type",
"application/pem-certificate-chain; charset=utf-8"},
{"link",
"<https://ca.mydomain.local:8000/acme/acme/directory>;rel=\"index\""},
{"replay-nonce",
".."}],
<<"-----BEGIN CERTIFICATE-----........\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----........\n-----END CERTIFICATE-----\n">>}
2022-11-07 08:30:28.609162+00:00 [error] Failed to request certificate for jabber-gw.mydomain.me: HTTP error: unexpected content type: application/pem-certificate-chain; charset=utf-8
2022-11-07 08:30:28.609456+00:00 [debug] Unregistering ACME challenge #Ref<0.1802325958.1657798659.124306>
2022-11-07 08:35:26.914567+00:00 [debug] Error when retrieving http headers gen_tcp: timeout
Any ideas on why its not happy with the content type and how to resolve?
Prior to the error message, the logs show what looks like a successful ACME challenge:
[<<".well-known">>,<<"acme-challenge">>,
<<"3rNIelLxSuDU0tWZgb3yEw5sL6d6Z61J">>] matches [<<".well-known">>,
<<"acme-challenge">>]
2022-11-04 04:28:12.436337+00:00 [debug] Received ACME challenge request for token: blah
2022-11-04 04:28:12.546710+00:00 [debug] HTTP response: {{"HTTP/1.1",200,"OK"},
The smallstep container was built with this great blog.
I have an app build with joy-5.0.13 where I cannot send some variable value to the template to be rendered on screen. I'm sure its something simple that I'm missing right now.
This is my action:
#MadvocAction
public class IndexAction {
#PetiteInject
private TemperatureService temperatureService;
#Out
List<TemperatureLog> temps;
#Action
public void view() {
temps = temperatureService.getLastHoutTemperatures();
System.out.println(temps);
}
and this is the file called index.jsp
<%# taglib prefix="j" uri="/jodd" %>
<html>
<head>
<title>SmartHome</title>
</head>
<body>
<j:iter items="${temps}" var="tl">
${tl.temperature}<br/>
</j:iter>
</body>
</html>
and here it is the log from the console:
80281 [DEBUG] j.m.c.MadvocController.invoke:102 - Action path: GET /index
80281 [DEBUG] j.m.c.MadvocController.invoke:125 - Invoke action for '/index' using ro.videanuadrian.sh.action.IndexAction#view
80291 [DEBUG] j.j.i.LocalizationUtil.setRequestBundleName:78 - Bundle name for this request: ro.videanuadrian.sh.action.IndexAction
80297 [DEBUG] j.j.JtxTransactionManager.requestTransaction:272 - Requesting TX jtx{Required,readonly,Read Committed,-1}
80299 [DEBUG] j.j.JtxTransaction.<init>:102 - New JTX {status:Active, mode:jtx{Required,readonly,Read Committed,-1}}
80321 [DEBUG] j.d.j.DbJtxSessionProvider.getDbSession:57 - Requesting db TX manager session
80322 [DEBUG] j.d.DbSession.<init>:60 - Creating new db session
80323 [DEBUG] j.d.j.DbJtxResourceManager.beginTransaction:71 - begin jtx
80325 [DEBUG] j.d.DbSession.beginTransaction:242 - Beginning transaction
80325 [DEBUG] j.d.p.CoreConnectionPool.getConnection:256 - Returning valid pooled connection
80443 [DEBUG] j.d.DbQueryBase.execute:686 - Executing statement: SELECT tt.id, tt.sensor_id, tt.temperature, tt.timestamp FROM sh_temperature_log tt WHERE tt.timestamp>1577460508000 ORDER BY tt.id ASC
80503 [DEBUG] j.d.DbQueryBase.execute:704 - execution time: 70ms
80526 [DEBUG] j.j.w.LeanJtxWorker.maybeCommitTransaction:93 - commit tx
80526 [DEBUG] j.j.JtxTransaction.commitOrRollback:255 - Commit JTX
80526 [DEBUG] j.d.j.DbJtxResourceManager.commitTransaction:83 - commit jtx
80526 [DEBUG] j.d.DbSession.commitTransaction:254 - Committing transaction
80614 [DEBUG] j.d.DbSession.closeSession:84 - Closing db session
[TemperatureLog [sensorId=1, timestamp=1577535822000, temperature=23.0], TemperatureLog [sensorId=1, timestamp=1577535826000, temperature=24.0], TemperatureLog [sensorId=1, timestamp=1577535829000, temperature=25.0], TemperatureLog [sensorId=1, timestamp=1577535844000, temperature=26.5]]
80623 [DEBUG] j.m.c.MadvocController.render:202 - Result type: ServletDispatcherActionResult
80623 [DEBUG] j.m.r.AbstractTemplateViewActionResult.render:91 - new target: /index:
80623 [DEBUG] j.m.r.ServletDispatcherActionResult.targetExists:105 - target check: /index.jspf
80624 [DEBUG] j.m.r.ServletDispatcherActionResult.targetExists:105 - target check: /index.jsp
80625 [DEBUG] j.m.r.AbstractTemplateViewActionResult.render:102 - target found: /index.jsp
but in the view I only get:
${tl.temperature}
it's like the result it's not reaching the view engine. I've made some debug and it seems that the actionResult is null.
Any idea what I`m doing wrong?
Thanks
P.S. I have tried the toturial and I have the same issue:
Messages
${msg.messageId} ${msg.text}
${resp.responseId} ${resp.text}
new message...
REST APi: message 1
that is the output that I have
This should work. Here is a working example:
#MadvocAction
public class FooAction {
#Out
List<Integer> temps;
#Action
public void view() {
temps = new ArrayList<>();
temps.add(30);
temps.add(20);
System.out.println(temps);
}
}
This action is mapped to /foo. This is important! You need to call the action, not the .jsp in your browser. My foo.jsp code looks like yours:
Temperatures:
<j:iter items="${temps}" var="tl">
${tl}<br/>
</j:iter>
So, it really should work.
Maybe you can use Jodd-Joy: it is a predefined Jodd bundle. It displays the list of link nicely on the beginning, like this:
If you want, you can send me your code/example.
It give error about some problem with STARTTLS command .
it gives the error like this
javax.mail.sendfailedexception sending failed nested exception is class javax.mail.MessagingException
So please help me out of it.
Java Code
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class MailDemo {
public static void main(String[] args) {
Properties properties=new Properties();
properties.put("mail.smtp.auth", "true");
properties.put("mail.smtp.starttls.enable","true");
properties.put("mail.smtp.host","smtp.gmail.com");
properties.put("mail.smtp.port", "587");
Scanner scn=new Scanner(System.in);
System.out.println("Username for Authentication :");
final String username=scn.nextLine();
System.out.println("Password for Authentication :");
final String password=scn.nextLine();
System.out.println("From Email..");
String fromEmailAddrs=scn.nextLine();
System.out.println("To Email..");
String toEmail=scn.nextLine();
System.out.println("Subject..");
String subject=scn.nextLine();
System.out.println("Message..");
String textMessage=scn.nextLine();
Session session=Session.getDefaultInstance(properties,new Authenticator() {
#Override
protected javax.mail.PasswordAuthentication getPasswordAuthentication(){
return new javax.mail.PasswordAuthentication(username, password);
}
});
try{
Message msg=new MimeMessage(session);
msg.setFrom(new InternetAddress(fromEmailAddrs));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toEmail));
msg.setSubject(subject);
msg.setText(textMessage);
Transport.send(msg);
System.out.println("/n Your Message Delivered Succesfully");
}
catch(MessagingException m){
throw new RuntimeException(m);
}
}
}
Console
Username for Authentication :
bijaybhaskar01
Password for Authentication :
abcdef#456789
From Email..
bijaybhaskar01#gmail.com
To Email..
bbswain1001#gmail.com
Subject..
Hello
Message..
hai
Output
Exception in thread "main" java.lang.RuntimeException: javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. fh14sm3131583pab.31 - gsmtp
at com.mail.bhaskar.MailDemo.main(MailDemo.java:52)
Caused by: javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. fh14sm3131583pab.31 - gsmtp
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at com.mail.bhaskar.MailDemo.main(MailDemo.java:48)
Debug output
DEBUG: JavaMail version 1.3.1
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.8.0_77\lib\javamail.providers (The system cannot find the file specified)
DEBUG: URL jar:file:/E:/Study/Java/Jars/MailJars/gimap.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/E:/Study/Java/Jars/MailJars/gimap.jar!/META-INF/javamail.providers
DEBUG: URL jar:file:/E:/Study/Java/Jars/MailJars/imap.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/E:/Study/Java/Jars/MailJars/imap.jar!/META-INF/javamail.providers
DEBUG: URL jar:file:/E:/Study/Java/Jars/MailJars/pop3.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/E:/Study/Java/Jars/MailJars/pop3.jar!/META-INF/javamail.providers
DEBUG: URL jar:file:/E:/Study/Java/Jars/MailJars/smtp.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/E:/Study/Java/Jars/MailJars/smtp.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.gimap.GmailSSLStore=javax.mail.Provider[STORE,gimaps,com.sun.mail.gimap.GmailSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.gimap.GmailStore=javax.mail.Provider[STORE,gimap,com.sun.mail.gimap.GmailStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], gimap=javax.mail.Provider[STORE,gimap,com.sun.mail.gimap.GmailStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], gimaps=javax.mail.Provider[STORE,gimaps,com.sun.mail.gimap.GmailSSLStore,Oracle]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: URL jar:file:/E:/Study/Java/Jars/MailJars/smtp.jar!/META-INF/javamail.address.map
DEBUG: successfully loaded resource: jar:file:/E:/Study/Java/Jars/MailJars/smtp.jar!/META-INF/javamail.address.map
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.8.0_77\lib\javamail.address.map (The system cannot find the file specified)
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 587
220 smtp.gmail.com ESMTP n6sm3627811pfa.2 - gsmtp
DEBUG SMTP: connected to host "smtp.gmail.com", port: 587
EHLO Bhaskar
250-smtp.gmail.com at your service, [119.82.116.106]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250 SMTPUTF8
DEBUG SMTP: Found extension "SIZE", arg "35882577"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "SMTPUTF8", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<bijaybhaskar01#gmail.com>
530 5.7.0 Must issue a STARTTLS command first. n6sm3627811pfa.2 - gsmtp
QUIT
You're using JavaMail 1.3.1, which is ancient and does not support STARTTLS.
Upgrade to a newer version.
when I make a request to a url, sometimes i get a 403 response and the app crashes
I have edited my entitlements-Release.plist and entitlements-debug.plist so that they contain:
key-chain-access-groups: Array
item 0: $(AppIdentifierPrefix)worklight.group
this step let me make the call a few more times, but eventually crashed my app again
mfp -v 7.1.0.00.20151227-1730
2016-01-21 12:41:49.332 kmf[2236:1264285] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2015/11/14 16:38:36
2016-01-21 12:41:49.362 kmf[2236:1266048] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] +[WLAFHTTPRequestOperationManagerWrapper requestWithURL:] in WLAFHTTPRequestOperationManagerWrapper.m:52 :: Request url is http://sdc01dcxp01.keybank.com:16131/kmf/adapters/kttAdapter/mfp/itemAdd
2016-01-21 12:41:49.372 kmf[2236:1266048] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper start] in WLAFHTTPRequestOperationManagerWrapper.m:320 :: Starting the request with URL http://sdc01dcxp01.keybank.com:16131/kmf/adapters/kttAdapter/mfp/itemAdd
2016-01-21 12:41:50.296 kmf[2236:1264285] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:352 :: Request Failed
2016-01-21 12:41:50.298 kmf[2236:1264285] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:353 :: Response Status Code : 403
2016-01-21 12:41:50.308 kmf[2236:1264285] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:354 :: Response Error : Request failed: forbidden (403)
2016-01-21 12:41:50.316 kmf[2236:1264285] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2015/11/14 16:38:36
2016-01-21 12:41:50.327 kmf[2236:1264285] THREAD WARNING: ['WLApp'] took '11.582275' ms. Plugin should use a background thread.
2016-01-21 12:41:50.328 kmf[2236:1267145] [DEBUG] [NONE] Request [http://sdc01dcxp01.keybank.com:16131/kmf/authorization/v1/authorization]
2016-01-21 12:41:51.072 kmf[2236:1264285] [ERROR] [CERTIFICATE_MANAGER] +[WLCertManager generateKeyPair:withPublicKeyLabel:withKeySize:] in WLCertManager.m:222 :: generating keypair --> Failed
2016-01-21 12:41:51.121 kmf[2236:1264285] [FATAL] [WORKLIGHT] Uncaught Exception: Keychain returned the following status: -34018
2016-01-21 12:41:51.154 kmf[2236:1264285] *** Terminating app due to uncaught exception 'Unable to generate key pair.', reason: 'Keychain returned the following status: -34018'
*** First throw call stack:
(0x18374d900 0x182dbbf80 0x18374d848 0x10041217c 0x10041640c 0x1003f8428 0x100371670 0x1000e6860 0x1000e612c 0x18410244c 0x1837055f4 0x183705298 0x1837029ac 0x183631680 0x184b40088 0x1884a8d90 0x100088f88 0x1831d28b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
A web server may return a 403 Forbidden HTTP status code in response to a request from a client for a web page or resource to indicate that the server can be reached and understood the request, but refuses to take any further action. Status code 403 responses are the result of the web server being configured to deny access, for some reason, to the requested resource by the client.
entitlements-Release.plist and entitlements-debug.plist edits are alright so more clarification check out this link
mobilefirst native ios keychain wrapper issue