I am having a issue while running automation script
I am getting org.openqa.selenium.InvalidSelectorException: javax.xml.transform.TransformerException: error
Sample code:
//driver.findElementByAccessibilityId("RootTopLeftMenuButton");
//driver.findElement(By.xpath("//android.view.ViewGroup[@accessibility id=RootTopLeftMenuButton]")).click();
//driver.findElement(By.xpath("//android.view.ViewGroup[@content-desc=\'RootTopLeftMenuButton\']")).click();
driver.findElement(By.xpath("//*[@accessibility id=\'RootTopLeftMenuButton\']")).click();
// driver.findElement(By.id("RootTopLeftMenuButton")).click();
Find the appium logs
[Appium] Welcome to Appium v1.9.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appPackage":"com.rt.pinprickeffect.meditation.staging","appActivity":"com.rt.pinprickeffect.meditation.MainActivity","browserName":"","platformName":"Android","deviceName":"Honor 9Lite","version":8}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"appPackage":"com.rt.pinprickeffect.meditation.staging","appActivity":"com.rt.pinprickeffect.meditation.MainActivity","browserName":"","platformName":"Android","deviceName":"Honor 9Lite","version":8},null,null]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1538120223739 (13:07:03 GMT+0530 (India Standard Time))
[Appium] Creating new AndroidDriver (v3.7.0) session
[Appium] Capabilities:
[Appium] appPackage: com.rt.pinprickeffect.meditation.staging
[Appium] appActivity: com.rt.pinprickeffect.meditation.MainActivity
[Appium] browserName:
[Appium] platformName: Android
[Appium] deviceName: Honor 9Lite
[Appium] version: 8
[debug] [BaseDriver] Creating session with MJSONWP desired capabilities: {"appPackage":"com.rt.pinpr...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: version.
[BaseDriver] Session created with session id: 4623d7a2-01fe-459c-a886-878ac21fa192
[AndroidDriver] Java version is: 1.8.0_141
[ADB] Checking whether adb is present
[ADB] Found 5 'build-tools' folders under 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows' (newest first):
[ADB] C:/Users/Mahadev/AndriodSoftwere/android-sdk-windows/build-tools/28.0.3
[ADB] C:/Users/Mahadev/AndriodSoftwere/android-sdk-windows/build-tools/26.0.2
[ADB] C:/Users/Mahadev/AndriodSoftwere/android-sdk-windows/build-tools/26.0.0
[ADB] C:/Users/Mahadev/AndriodSoftwere/android-sdk-windows/build-tools/25.0.2
[ADB] C:/Users/Mahadev/AndriodSoftwere/android-sdk-windows/build-tools/23.0.1
[ADB] Using adb.exe from C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[AndroidDriver] Using device: emulator-5554
[debug] [ADB] Setting device id to emulator-5554
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk'
[debug] [ADB] Current device property 'ro.build.version.sdk': 24
[debug] [ADB] Device API level: 24
[AndroidDriver] Consider setting 'automationName' capability to 'uiautomator2' on Android >= 6, since UIAutomator framework is not maintained anymore by the OS vendor.
[AndroidDriver] App file was not listed, instead we're going to run com.rt.pinprickeffect.meditation.staging directly on the device
[debug] [AndroidDriver] Checking whether package is present on the device
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pm list packages com.rt.pinprickeffect.meditation.staging'
[AndroidDriver] Starting Android session
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 wait-for-device'
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell echo ping'
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pm list packages io.appium.settings'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.settings'
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\build-tools\28.0.3\aapt.exe
[debug] [ADB] The installed 'io.appium.settings' package does not require upgrade ('2.3.0' >= '2.3.0')
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell ps'
[debug] [AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[debug] [ADB] Device API level: 24
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell appops set io.appium.settings android\:mock_location allow'
[AndroidDriver] setDeviceLanguageCountry requires language or country.
[AndroidDriver] Got language: 'null' and country: 'null'
[debug] [Logcat] Starting logcat capture
[debug] [AndroidDriver] Pushing unlock helper app to device...
[debug] [ADB] Getting install status for io.appium.unlock
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pm list packages io.appium.unlock'
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for 'io.appium.unlock'
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.unlock'
[debug] [ADB] The installed 'io.appium.unlock' package does not require upgrade ('2.0.0' >= '2.0.0')
[ADB] Getting device platform version
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 7.0
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell wm size'
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.product.model'
[debug] [ADB] Current device property 'ro.product.model': Android SDK built for x86
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.product.manufacturer'
[debug] [ADB] Current device property 'ro.product.manufacturer': Google
[AndroidDriver] No app sent in, not parsing package/activity
[debug] [AndroidDriver] No app capability. Assuming it is already on the device
[debug] [ADB] Getting install status for com.rt.pinprickeffect.meditation.staging
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pm list packages com.rt.pinprickeffect.meditation.staging'
[debug] [ADB] App is installed
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop com.rt.pinprickeffect.meditation.staging'
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pm clear com.rt.pinprickeffect.meditation.staging'
[debug] [AndroidDriver] Performed fast reset on the installed 'com.rt.pinprickeffect.meditation.staging' application (stop and clear)
[debug] [AndroidBootstrap] Watching for bootstrap disconnect
[debug] [ADB] Forwarding system: 4724 to device: 4724
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 forward tcp\:4724 tcp\:4724'
[debug] [UiAutomator] Starting UiAutomator
[debug] [UiAutomator] Moving to state 'starting'
[debug] [UiAutomator] Parsing uiautomator jar
[debug] [UiAutomator] Found jar name: 'AppiumBootstrap.jar'
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 push C\:\\Users\\Mahadev\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\appium-android-bootstrap\\bootstrap\\bin\\AppiumBootstrap.jar /data/local/tmp/'
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell ps'
[ADB] No uiautomator process found to kill, continuing...
[debug] [UiAutomator] Starting UIAutomator
[debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","emulator-5554","shell","uiautomator","runtest","AppiumBootstrap.jar","-c","io.appium.android.bootstrap.Bootstrap","-e","pkg","com.rt.pinprickeffect.meditation.staging","-e","disableAndroidWatchers",false,"-e","acceptSslCerts",false]
[debug] [UiAutomator] Moving to state 'online'
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Loading json...
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.
[AndroidBootstrap] Android bootstrap socket is now connected
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys window'
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected
[AndroidDriver] Screen already unlocked, doing nothing
[debug] [ADB] Device API level: 24
[debug] [ADB] Running 'C:\Users\Mahadev\AndriodSoftwere\android-sdk-windows\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am start -W -n com.rt.pinprickeffect.meditation.staging/com.rt.pinprickeffect.meditation.MainActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000'
[Appium] New AndroidDriver session created successfully, session 4623d7a2-01fe-459c-a886-878ac21fa192 added to master session list
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1538120229793 (13:07:09 GMT+0530 (India Standard Time))
[debug] [MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"com.rt.pinprickeffect.meditation.staging","appActivity":"com.rt.pinprickeffect.meditation.MainActivity","browserName":"","platformName":"Android","deviceName":"Honor 9Lite","version":8},"appPackage":"com.rt.pinprickeffect.meditation.staging","appActivity":"com.rt.pinprickeffect.meditation.MainActivity","browserName":"","platformName":"Android","deviceName":"emulator-5554","version":8,"deviceUDID":"emulator-5554","platformVersion":"7.0","deviceScreenSize":"1440x2560","deviceModel":"Android SDK built for x86","deviceManufacturer":"Google"}
[HTTP] <-- POST /wd/hub/session 200 6063 ms - 835
[HTTP]
[HTTP] --> POST /wd/hub/session/4623d7a2-01fe-459c-a886-878ac21fa192/timeouts
[HTTP] {"type":"implicit","ms":30000}
[debug] [MJSONWP] Calling AppiumDriver.timeouts() with args: ["implicit",30000,null,null,null,"4623d7a2-01fe-459c-a886-878ac21fa192"]
[debug] [BaseDriver] MJSONWP timeout arguments: {"type":"implicit","ms":30000}}
[debug] [BaseDriver] Set implicit wait to 30000ms
[debug] [MJSONWP] Responding to client with driver.timeouts() result: null
[HTTP] <-- POST /wd/hub/session/4623d7a2-01fe-459c-a886-878ac21fa192/timeouts 200 21 ms - 76
[HTTP]
[HTTP] --> POST /wd/hub/session/4623d7a2-01fe-459c-a886-878ac21fa192/element
[HTTP] {"using":"xpath","value":"//*[@accessibility id='RootTopLeftMenuButton']"}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["xpath","//*[@accessibility id='RootTopLeftMenuButton']","4623d7a2-01fe-459c-a886-878ac21fa192"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [BaseDriver] Waiting up to 30000 ms for condition
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//*[@accessibility id='RootTopLeftMenuButton']","context":"","multiple":false}}
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [MJSONWP] Matched JSONWP error code 32 to InvalidSelectorError
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//*[@accessibility id='RootTopLeftMenuButton']","context":"","multiple":false}}
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//*[@accessibility id='RootTopLeftMenuButton']' using 'XPATH' with the contextId: '' multiple: false
[debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":32,"value":"javax.xml.transform.TransformerException: Expected ], but found: id"}
[MJSONWP] Encountered internal error running command: InvalidSelectorError: javax.xml.transform.TransformerException: Expected ], but found: id
[MJSONWP] at errorFromMJSONWPStatusCode (C:\Users\Mahadev\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:784:12)
[MJSONWP] at Socket.<anonymous> (C:\Users\Mahadev\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-bootstrap\lib\bootstrap.js:139:18)
[MJSONWP] at emitOne (events.js:116:13)
[MJSONWP] at Socket.emit (events.js:211:7)
[MJSONWP] at addChunk (_stream_readable.js:263:12)
[MJSONWP] at readableAddChunk (_stream_readable.js:246:13)
[MJSONWP] at Socket.Readable.push (_stream_readable.js:208:10)
[MJSONWP] at TCP.onread (net.js:594:20)