Unable to set context

#1

when I use getContextList(), I see the below data returning.
NATIVE_APP_INSTRUMENTED
NATIVE_APP
But, I am unable to set context using SeeTestClient. Below is the error in logs

2019-07-27 23:42:46,306 [Restlet-1442072963-executeScript-sid:ed75ba73-c8fe-4582-8ca9-cd4036ff5101] (backend.commands.AppiumCommand) DEBUG Appium:execute - Start Execute
2019-07-27 23:42:46,308 [Restlet-1442072963-executeScript-sid:ed75ba73-c8fe-4582-8ca9-cd4036ff5101] (backend.commands.AppiumCommand) ERROR Failed to execute ‘executeScript seetest:client.setContext(“NATIVE_APP”)’
com.experitest.image.agent.appium.backend.errors.STAppiumException: Could not find a method ‘setContext’ matching with 1 parameters
at com.experitest.image.agent.appium.backend.errors.STAppiumException.newBadParametersException(STAppiumException.java:67)
at com.experitest.image.agent.appium.backend.commands.browser.executescript.ControllerCommandParser.getMethodByName(ControllerCommandParser.java:103)
at com.experitest.image.agent.appium.backend.commands.browser.executescript.ControllerCommandParser.execute(ControllerCommandParser.java:41)
at com.experitest.image.agent.appium.backend.commands.browser.executescript.manager.CommandManager.executeCommand(CommandManager.java:60)
at com.experitest.image.agent.appium.backend.commands.browser.ExecuteScriptCommand.executeJavaScript(ExecuteScriptCommand.java:112)
at com.experitest.image.agent.appium.backend.commands.browser.ExecuteScriptCommand.doExecute(ExecuteScriptCommand.java:262)
at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173)
at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:306)
at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2019-07-27 23:42:46,308 [Restlet-1442072963-executeScript-sid:ed75ba73-c8fe-4582-8ca9-cd4036ff5101] (backend.commands.AppiumCommand) ERROR Exception of type ‘com.experitest.image.agent.appium.backend.errors.STAppiumException’ : javascript error. Could not find a method ‘setContext’ matching with 1 parameters
com.experitest.image.agent.appium.backend.errors.STAppiumException: javascript error. Could not find a method ‘setContext’ matching with 1 parameters
at com.experitest.image.agent.appium.backend.errors.STAppiumException.newJavascriptException(STAppiumException.java:155)
at com.experitest.image.agent.appium.backend.commands.browser.ExecuteScriptCommand.executeJavaScript(ExecuteScriptCommand.java:116)
at com.experitest.image.agent.appium.backend.commands.browser.ExecuteScriptCommand.doExecute(ExecuteScriptCommand.java:262)
at com.experitest.image.agent.appium.backend.commands.AppiumCommand.execute(AppiumCommand.java:173)
at com.experitest.image.agent.appium.http.AppiumGenericCommandHandler.lambda$executeCommand$1(AppiumGenericCommandHandler.java:306)
at com.experitest.utils.background.BackgroundTasks$DelegatingRenamingCallable.call(BackgroundTasks.java:220)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

0 Likes

#2

Hi,

Can you paste the how you are calling the setContext function ? Paste the line please.

If you using RemoteDriver as parameter to SeeTestClient you can probably try driver.context("")

See http://appium.io/docs/en/commands/context/set-context/

1 Like

#3

I am using below method. I am using SeeTestClient object.

seetest.setContext(“NATIVE_APP”);

0 Likes

#4

Please try my suggestion

0 Likes

#5

Thanks for the suggestion. It worked.

0 Likes