Closed anuj-agrawal-groww closed 6 months ago
i couldn't reproduce the issue from my side. Could you share me the entire complete server logs with the error message? Also attach the code you are using in the client side.
In the appium log you attached i don't see any webdriver call made to execute script endpoint. Could you add the full logs with the error throw at executeScript command.
Hi @sudharsan-selvaraj I am also facing the same issue…. In appium logs there is calls happening related to the interceptor.
@SubbuLomada Are you calling the command using javascript executer as below
((JavascriptExecutor) driver).executeScript("interceptor: startListening");
@anuj-agrawal-groww Looks like you are using driver.execute()
method instead of ((JavascriptExecutor) driver).executeScript();
. I have updated the docs with a note on how to use the plugin with java client. Let me know if you still face the issue after using JavascriptExecutor.
hey @sudharsan-selvaraj, thanks for the update. I'll try it out and let you know.
Hi @sudharsan-selvaraj with JavaScript it is working fine thank you…
Hi @sudharsan-selvaraj, i tried to use the other commands using java client, but again I'm getting command not supported exception, I'm attaching the multiple approaches that i used:
String cmd="\"interceptor: startListening\", [{\n" +
" config: {\n" +
" \"include\" : {\n" +
" url \"**/groww.in/**\",\n" +
" }\n" +
" }\n" +
" }]";
((JavascriptExecutor) driver).executeScript(cmd);
String script = "interceptor: startListening([{config: {include: {url: '**/reqres.in/**'}}}]);";
((JavascriptExecutor) driver).executeScript(script);
((JavascriptExecutor) driver).executeScript(
"interceptor: startListening",
new Object[] {
new Object[] {
"config",
new Object() {
String include = "url **/reqres.in/**";
}
}
}
);
I'm also getting command not supported exception. Is there a fix for this?
org.openqa.selenium.UnsupportedCommandException: {"value":{"error":"unknown method","message":"Method is not implemented","stacktrace":"NotImplementedError: Method is not implemented\n at AndroidUiautomator2Driver.execute ...
I use Appiumdriver:
private static AppiumDriver driver; with
private static void setCapabilities() throws MalformedURLException {
UiAutomator2Options options = new UiAutomator2Options();
options.setDeviceName("OnePlus 9");
options.setAutomationName("UIAutomator2");
options.setPlatformName("Android");
options.setApp(System.getProperty("user.dir") + "/demo-release - 2022-03-21T150915.559.apk");
options.setPlatformVersion("14");
options.setCapability("appium:intercept",true);
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), options);
}
I execute:
((JavascriptExecutor) driver).executeScript("interceptor:startListening");
@anuj-agrawal-groww @BartVanRaemdonck can you please share full server logs as gist
My logs:
org.openqa.selenium.UnsupportedCommandException: {"value":{"error":"unknown method","message":"Method is not implemented","stacktrace":"NotImplementedError: Method is not implemented\n at AndroidUiautomator2Driver.execute (/Users/bvanraemdonck/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/execute.js:121:11)\n at commandExecutor (/opt/homebrew/Cellar/appium/2.5.4/libexec/lib/node_modules/appium/node_modules/@appium/base-driver/lib/basedriver/driver.ts:106:18)\n at /opt/homebrew/Cellar/appium/2.5.4/libexec/lib/node_modules/appium/node_modules/async-lock/lib/index.js:171:12\n at AsyncLock._promiseTry (/opt/homebrew/Cellar/appium/2.5.4/libexec/lib/node_modules/appium/node_modules/async-lock/lib/index.js:306:31)\n at exec (/opt/homebrew/Cellar/appium/2.5.4/libexec/lib/node_modules/appium/node_modules/async-lock/lib/index.js:170:9)\n at AsyncLock.acquire (/opt/homebrew/Cellar/appium/2.5.4/libexec/lib/node_modules/appium/node_modules/async-lock/lib/index.js:189:3)\n at AndroidUiautomator2Driver.executeCommand (/opt/homebrew/Cellar/appium/2.5.4/libexec/lib/node_modules/appium/node_modules/@appium/base-driver/lib/basedriver/driver.ts:122:39)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)\n at defaultBehavior (/opt/homebrew/Cellar/appium/2.5.4/libexec/lib/node_modules/appium/lib/appium.js:1109:14)\n at AppiumInterceptorPlugin.executeMethod (/opt/homebrew/Cellar/appium/2.5.4/libexec/lib/node_modules/appium/node_modules/@appium/base-plugin/lib/plugin.js:73:14)"}} Command duration or timeout: 10 milliseconds Build info: version: '4.21.0', revision: '79ed462ef4' System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '14.5', java.version: '15.0.10' Driver info: io.appium.java_client.android.AndroidDriver Command: [d044b5f7-9847-4230-8c71-f3554a4ee50d, executeScript {script=interceptor:startListening, args=[]}] Capabilities {appium:app: /Users/bvanraemdonck/Docume..., appium:appPackage: be.persgroep.advertising.ba..., appium:automationName: UIAutomator2, appium:databaseEnabled: false, appium:desired: {app: /Users/bvanraemdonck/Docume..., automationName: UIAutomator2, deviceName: OnePlus 9, intercept: true, platformName: ANDROID, platformVersion: 14}, appium:deviceApiLevel: 34, appium:deviceManufacturer: OnePlus, appium:deviceModel: LE2113, appium:deviceName: 42fd9bd6, appium:deviceScreenDensity: 480, appium:deviceScreenSize: 1080x2400, appium:deviceUDID: 42fd9bd6, appium:intercept: true, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:pixelRatio: 3, appium:platformVersion: 14, appium:statBarHeight: 103, appium:takesScreenshot: true, appium:viewportRect: {height: 2297, left: 0, top: 103, width: 1080}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID} Session ID: d044b5f7-9847-4230-8c71-f3554a4ee50d at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:221) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:170) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:571) at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:463) at FirstTestA.firstTest(FirstTestA.java:80) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Share full server logs
Hi, I was just checking in if someone had time to check my logs? Maybe we could reopen this issue?
@BartVanRaemdonck The command is incorrect(missed a white space after :
). The actual command is
interceptor: startListening
I am facing "interceptor: startListening" command not supported My appium version is: 2.0.1 Appium-interceptor plugin version: 1.0.0-beta.8 Java 11 capabilities.setCapability("appium:intercept ", "true");
Logs: