Skip to content
This repository was archived by the owner on Feb 11, 2022. It is now read-only.
This repository was archived by the owner on Feb 11, 2022. It is now read-only.

error: Element had a width or height of zero; cannot slice such an image #60

Open
@vikasthange

Description

@vikasthange

Failed for below line of code:
wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.custom("ai:bluetooth"))).click();

Mode: testaiFindMode: object_detection

Appium Server Log:

[ai] Writing screenshot to /usr/local/lib/node_modules/test-ai-classifier/build-js/lib/Fri, 23 Jul 2021 23:48:54 GMT_classifiertest.png for use in object detection
[ai] Gathering object candidates from tensorflow native
2021-07-23 19:48:54.582361: I tensorflow/cc/saved_model/reader.cc:31] Reading SavedModel from: /usr/local/lib/node_modules/test-ai-classifier/model/obj_detection_model
2021-07-23 19:48:54.735042: I tensorflow/cc/saved_model/reader.cc:54] Reading meta graph with tags { serve }
2021-07-23 19:48:55.471939: I tensorflow/cc/saved_model/loader.cc:202] Restoring SavedModel bundle.
2021-07-23 19:48:55.472008: I tensorflow/cc/saved_model/loader.cc:212] The specified SavedModel has no variables; no checkpoints were restored. File does not exist: /usr/local/lib/node_modules/test-ai-classifier/model/obj_detection_model/variables/variables.index
2021-07-23 19:48:55.472023: I tensorflow/cc/saved_model/loader.cc:311] SavedModel load for tags { serve }; Status: success. Took 889664 microseconds.
[ai] Candidates retrieved
[debug] [W3C (4be259c1)] Encountered internal error running command: Error: Element had a width or height of zero; cannot slice such an image
[debug] [W3C (4be259c1)]     at elementImageFromScreenshot (/usr/local/lib/node_modules/test-ai-classifier/lib/image.js:45:11)
[debug] [W3C (4be259c1)]     at map (/usr/local/lib/node_modules/test-ai-classifier/lib/classifier.js:340:23)
[debug] [W3C (4be259c1)]     at Array.map (<anonymous>)
[debug] [W3C (4be259c1)]     at asyncmap (/usr/local/lib/node_modules/test-ai-classifier/node_modules/asyncbox/lib/asyncbox.js:99:26)
[debug] [W3C (4be259c1)]     at findByObjectDetector (/usr/local/lib/node_modules/test-ai-classifier/lib/classifier.js:339:30)
[debug] [W3C (4be259c1)]     at runMicrotasks (<anonymous>)
[debug] [W3C (4be259c1)]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
[debug] [W3C (4be259c1)]     at Object.find (/usr/local/lib/node_modules/test-ai-classifier/lib/classifier.js:375:12)
[debug] [W3C (4be259c1)]     at condition (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/find.js:158:16)
[debug] [W3C (4be259c1)]     at wrappedCondFn (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/timeout.js:151:12)
[debug] [W3C (4be259c1)]     at spin (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:138:20)
[debug] [W3C (4be259c1)]     at waitForCondition (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:154:10)
[debug] [W3C (4be259c1)]     at AndroidUiautomator2Driver.implicitWaitForCondition (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/timeout.js:153:10)
[debug] [W3C (4be259c1)]     at AndroidUiautomator2Driver.findByCustom (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/find.js:172:5)
[debug] [W3C (4be259c1)]     at AndroidUiautomator2Driver.findElement (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/commands/find.js:50:12)
[HTTP] <-- POST /wd/hub/session/4be259c1-7fc0-42c7-8612-8af8e8d6ee38/element 500 17760 ms - 627
[HTTP] 

Java Exception:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Element had a width or height of zero; cannot slice such an image
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Vikas-MacBook-Pro.local', ip: '2601:cb:8280:3cd0:71af:483c:c870:4847%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_301'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: com.android.settings.Settings, customFindModules: {ai: test-ai-classifier}, databaseEnabled: false, desired: {appActivity: com.android.settings.Settings, customFindModules: {ai: test-ai-classifier}, deviceName: emulator-5554, fastReset: true, platformName: android, shouldUseCompactResponses: false, testaiFindMode: object_detection, testaiObjDetectionDebug: true}, deviceApiLevel: 30, deviceManufacturer: Google, deviceModel: sdk_gphone_x86_arm, deviceName: emulator-5554, deviceScreenDensity: 440, deviceScreenSize: 1080x2340, deviceUDID: emulator-5554, fastReset: true, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 2.75, platform: LINUX, platformName: Android, platformVersion: 11, shouldUseCompactResponses: false, statBarHeight: 136, takesScreenshot: true, testaiFindMode: object_detection, testaiObjDetectionDebug: true, viewportRect: {height: 1936, left: 0, top: 136, width: 1080}, warnings: {}, webStorageEnabled: false}
Session ID: 4be259c1-7fc0-42c7-8612-8af8e8d6ee38
*** Element info: {Using=-custom, value=ai:bluetooth}

Capabilities:

capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "emulator-5554");
        capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.android.settings.Settings");
        capabilities.setCapability("fastReset", "true");
        HashMap<String, String> customFindModules = new HashMap<>();
        customFindModules.put("ai", "test-ai-classifier");
        capabilities.setCapability("customFindModules", customFindModules);
        capabilities.setCapability("shouldUseCompactResponses", false);
        capabilities.setCapability("testaiFindMode","object_detection");
        capabilities.setCapability("testaiObjDetectionDebug","true");
AppiumDriver<WebElement> driver = new AndroidDriver<>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
        ((AndroidDriver)driver).startActivity(new Activity("com.android.settings","com.android.settings.Settings"));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions