This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SILK4J - Mobile App- How to get the Appium Driver to use JavaScriptExecutor

How can I get the Appium driver from Silk4j ?

Like when you get the WebDriver for Selenium:

BrowserApplication browserApplication = desktop.find("//BrowserApplication");

driver = browserApplication.getWebDriver();

But in Mobile I don´t have a browserApplication:

MobileDevice mobileDevice = desktop.find("//MobileDevice");

I want to use the driver with JavascriptExecutor for Gestures i.e.:

canScrollMore = (Boolean) ((JavascriptExecutor) driver).executeScript("mobile: scrollGesture", ImmutableMap.of(

"left", 100, "top", 100, "width", 200, "height", 200,

"direction", "down",

"percent", 3.0

));

  • Suggested Answer

    0  

    Hi  

    You will likely want to use the Invoke method against the MobileDevice object, that allows access to the methods available on the AppiumDriver.

    The following post has some example demonstrating the use of "executeScript" in Workbench:

     RE: Using PressKeys on Android 

    Regards
    Robert

  • 0 in reply to   

    Hi RobertM

    I get a very similar message than the post You shared:

    java.lang.RuntimeException: Error executing 'executeScript'. The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource

    Build info: version: '3.141.594', revision: 'b017c48', time: '2023-01-11T16:08:39'

    Thanks

  • Suggested Answer

    0   in reply to 

    Hi  

    I looked into the "mobile: scrollGesture" and it appears that it was introduced in Appium 1.19.

    Unfortunately Silk Test uses Appium 1.17.1 and you will not be able to invoke the gesture in question.

    Are you unable to achieve the required functionality using Silk Test's inbuilt Swipe methods?

    Regards
    Robert

  • 0 in reply to   

    Hi Robert

    We use the methods you mentioned, but the results are not always as expected. So, we tried it as an alternative as suggested in the docs.


    Thanks a lot