java-client
java-client copied to clipboard
Feature: Search for an inner element by an image
Description
Implement search for an inner element by an image.
Environment
- java-client: 8.3.0
- Appium server version: 2.0.0-beta.65
- Plugin: [email protected]
- Ubuntu 20.04
- Android
- Emulator
Details
Currently, searching for an element by image works for a driver object. Searching for an element using the root element object results in the error.
org.openqa.selenium.InvalidSelectorException: Locator Strategy '-image' is not supported for this session
Code To Reproduce Issue
public class MobileIcon extends Widget {
protected MobileIcon(WebElement element) {
super(element);
}
public Rectangle getRect() {
return findElement(AppiumBy.image(imageRefB64)).getRect();
}
}
This feature has been recently merged and is available now in the master branch of the server.
@mykola-mokhnach, when can we expect the feature to be released?
I believe it is available in the most recent server/plugin releases
I'd like to test it but now I'm getting an error when start the server
[debug] [Appium] Error: Cannot find module '@appium/support'
[debug] [Appium] Require stack:
[debug] [Appium] - /home/wazzeps/.appium/node_modules/@appium/images-plugin/build/lib/constants.js
[debug] [Appium] - /home/wazzeps/.appium/node_modules/@appium/images-plugin/build/lib/compare.js
[debug] [Appium] - /home/wazzeps/.appium/node_modules/@appium/images-plugin/build/lib/plugin.js
[debug] [Appium] - /home/wazzeps/.appium/node_modules/@appium/images-plugin/index.js
[debug] [Appium] - /home/wazzeps/.nvm/versions/node/v19.8.1/lib/node_modules/appium/build/lib/extension/extension-config.js
[debug] [Appium] - /home/wazzeps/.nvm/versions/node/v19.8.1/lib/node_modules/appium/build/lib/cli/extension-command.js
[debug] [Appium] - /home/wazzeps/.nvm/versions/node/v19.8.1/lib/node_modules/appium/build/lib/cli/driver-command.js
[debug] [Appium] - /home/wazzeps/.nvm/versions/node/v19.8.1/lib/node_modules/appium/build/lib/cli/extension.js
[debug] [Appium] - /home/wazzeps/.nvm/versions/node/v19.8.1/lib/node_modules/appium/build/lib/main.js
[debug] [Appium] - /home/wazzeps/.nvm/versions/node/v19.8.1/lib/node_modules/appium/index.js
[debug] [Appium] at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
[debug] [Appium] at Function.Module._load (node:internal/modules/cjs/loader:934:27)
[debug] [Appium] at Module.require (node:internal/modules/cjs/loader:1157:19)
[debug] [Appium] at require (node:internal/modules/helpers:119:18)
[debug] [Appium] at Object.
appium 2.0.0-beta.67 [email protected]
Could I have missed something?
I've created a patch to address that in the above PR
the patch is now included to the recent server version
It still doesn't work. The error is org.openqa.selenium.InvalidSelectorException: Locator Strategy '-image' is not supported for this session. I have tried this: getWrappedElement().findElement(AppiumBy.image(imageSelector))
appium 2.0.0-beta.71 [email protected] [email protected]
@mykola-mokhnach could you continue working on the feature?
Hi. I faced with the same error when trying to find element inside other element using image locator strategy. Do you have some advice how to fix it? I use the latest Appium 2.0.1
@mykola-mokhnach Hi. Could you clarify was it fixed in Appium 2.0.1? Because I see you made some fix steps, but other people and I still have the error when try to find element by image inside other element. Actually I use C# client, but it seems the Appium server issue, not a client.