Closed shankybnl closed 5 years ago
try using UIA2 as automationName
@saikrishna321 Thank you very much. It worked!
i have the same issue, i using uia2 and android 9
class FlipkartUiTests(unittest.TestCase):
def setUp(self):
"Setup for the test"
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '9'
desired_caps['deviceName'] = 'emulator-5554'
desired_caps['automationName'] = 'UIA2'
desired_caps['noReset'] = 'true'
desired_caps['app'] = os.path.join(os.path.dirname(__file__), '1.apk')
desired_caps['appPackage'] = 'com.flipkart.android'
desired_caps['appActivity'] = '.activity.HomeFragmentHolderActivity'
desired_caps["customFindModules"] = {"ai": "test-ai-classifier"}
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
self.driver.implicitly_wait(15)
def test_search(self):
self.driver.find_element_by_custom('ai:cart')
def tearDown(self):
"Tear down the test"
self.driver.quit()
Can somebody tell where I am going wrong. I am getting following error. I am using appium version 1.11.1
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot destructure property x
of 'undefined' or 'null'.
@prakashatul1 pls create a new issue and provide complete server logs
@prakashatul1 pls create a new issue and provide complete server logs
I will do that
@boya678 @prakashatul1 : I have tried running it on Android 9.0.3 (real device) with appium ver. 1.9.2-beta.2. It worked fine.
Here's the github project: https://github.com/shankybnl/appium-with-ai-capability
Appum version: 1.9.2-beta.2 java client: 969fac6a1c6dd229bdefb02ff10e71c812701e0c
Code to find element: public By cartImageWithAI = MobileBy.custom("ai:search");
Error: [debug] [W3C (7add219f)] Encountered internal error running command: TypeError: Cannot read property 'x' of undefined [debug] [W3C (7add219f)] at x (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/lib/image.js:50:10)
Below are full appium error logs:
[HTTP] {"using":"-custom","value":"ai:search"} [debug] [W3C (7add219f)] Calling AppiumDriver.findElements() with args: ["-custom","ai:search","7add219f-5d57-4eab-99a4-cbc778d89d50"] [debug] [BaseDriver] Find plugin 'ai' requested; will attempt to use it from 'test-ai-classifier' [debug] [BaseDriver] Waiting up to 0 ms for condition [ai] Retrieving current settings to check element response attributes [ai] We will need to update settings to include element response attributes [BaseDriver] Didn't know about setting 'elementResponseAttributes'. Are you sure you spelled it correctly? Proceeding anyway. Valid settings: imageMatchThreshold,fixImageFindScreenshotDims,fixImageTemplateSize,checkForImageElementStaleness,autoUpdateImageElementPosition,imageElementTapStrategy,ignoreUnimportantViews [ai] Setting confidence threshold to default value of 0.2 [ai] Retrieving data for all leaf-node elements on screen [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator [debug] [BaseDriver] Waiting up to 0 ms for condition [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//[not(child::)]","context":"","multiple":true}} [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//[not(child::)]","context":"","multiple":true}} [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 '//[not(child::)]' using 'XPATH' with the contextId: '' multiple: true [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.ImageButton, INSTANCE=0] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[CLASS=android.widget.ImageButton, INSTANCE=0] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Selector ends with instance. [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.ImageView, INSTANCE=0] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[CLASS=android.widget.ImageView, INSTANCE=0] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Selector ends with instance. [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.ImageView, INSTANCE=1] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[CLASS=android.widget.ImageView, INSTANCE=1] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Selector ends with instance. [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.ImageView, INSTANCE=2] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[CLASS=android.widget.ImageView, INSTANCE=2] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Selector ends with instance. [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.ImageView, INSTANCE=3] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[CLASS=android.widget.ImageView, INSTANCE=3] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Selector ends with instance. [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.TextView, INSTANCE=0] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[CLASS=android.widget.TextView, INSTANCE=0] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Selector ends with instance. [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.support.v7.widget.RecyclerView, INSTANCE=0] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[CLASS=android.support.v7.widget.RecyclerView, INSTANCE=0] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Selector ends with instance. [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.view.View, INSTANCE=0] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[CLASS=android.view.View, INSTANCE=0] [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Selector ends with instance. [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":[{"ELEMENT":"3"},{"ELEMENT":"4"},{"ELEMENT":"5"},{"ELEMENT":"6"},{"ELEMENT":"7"},{"ELEMENT":"8"},{"ELEMENT":"9"},{"ELEMENT":"10"}]} [debug] [AndroidBootstrap] Received command result from bootstrap [ai] Getting window size in case we need to scale screenshot [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"getDeviceSize","params":{}} [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"getDeviceSize","params":{}} [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getDeviceSize [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"height":960,"width":540}} [debug] [AndroidBootstrap] Received command result from bootstrap [ai] Getting screenshot to use for classifier [debug] [ADB] Device API level: 23 [ai] Turning screenshot into HTML image for use with canvas [ai] Getting screenshot slices for each element [ai] Resetting element response attribute setting to original value: undefined [debug] [W3C (7add219f)] Encountered internal error running command: TypeError: Cannot read property 'x' of undefined [debug] [W3C (7add219f)] at x (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/lib/image.js:50:10) [debug] [W3C (7add219f)] at /usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/lib/classifier.js:116:28 [debug] [W3C (7add219f)] at Generator.next ()
[debug] [W3C (7add219f)] at asyncGeneratorStep (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
[debug] [W3C (7add219f)] at _next (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
[debug] [W3C (7add219f)] at /usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
[debug] [W3C (7add219f)] at new Promise ()
[debug] [W3C (7add219f)] at /usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12
[debug] [W3C (7add219f)] at /usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/lib/classifier.js:114:30
[debug] [W3C (7add219f)] at Array.map ()
[debug] [W3C (7add219f)] at map (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/asyncbox/lib/asyncbox.js:75:26)
[debug] [W3C (7add219f)] at Generator.next ()
[debug] [W3C (7add219f)] at asyncGeneratorStep (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
[debug] [W3C (7add219f)] at _next (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
[debug] [W3C (7add219f)] at /usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
[debug] [W3C (7add219f)] at new Promise ()
[debug] [W3C (7add219f)] at /usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12
[debug] [W3C (7add219f)] at asyncmap (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/asyncbox/build/lib/asyncbox.js:160:20)
[debug] [W3C (7add219f)] at /usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/lib/classifier.js:114:30
[debug] [W3C (7add219f)] at Generator.next ()
[debug] [W3C (7add219f)] at asyncGeneratorStep (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
[debug] [W3C (7add219f)] at _next (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
[debug] [W3C (7add219f)] at /usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
[debug] [W3C (7add219f)] at new Promise ()
[debug] [W3C (7add219f)] at /usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12
[debug] [W3C (7add219f)] at getElementImages (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/build/lib/classifier.js:154:28)
[debug] [W3C (7add219f)] at Object.getElementImages (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/lib/classifier.js:205:32)
[debug] [W3C (7add219f)] at Generator.next ()
[debug] [W3C (7add219f)] at asyncGeneratorStep (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
[debug] [W3C (7add219f)] at _next (/usr/local/lib/node_modules/appium/node_modules/test-ai-classifier/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
[debug] [W3C (7add219f)] at
[HTTP] <-- POST /wd/hub/session/7add219f-5d57-4eab-99a4-cbc778d89d50/elements 500 8178 ms - 850
[HTTP]