0
    boolean canScrollMore = (Boolean) ((JavascriptExecutor) driver).executeScript("mobile: scrollGesture", ImmutableMap.of(
            "left", 100, "top", 100, "width", 200, "height", 200,
            "direction", "down",
            "percent", 3.0
        ));

Showing error in Immutable Maps "OF" The method of(K, V, K, V, K, V, K, V, K, V) in the type ImmutableMap is not applicable for the arguments (String, int, String, int, String, int, String, int, String, String, String, double)

2 Answers2

0

ImmutableList creates the List which is immutable. When we use ImmutableMap.of then the list can extend to 5 arguments. More than that will send errors as mentioned above.

When we need to send more than 5 Arguments, we need to use ImmutablMap.Builder().

Ex:

    boolean canScrollMore = (Boolean) ((JavascriptExecutor) driver).executeScript("mobile: scrollGesture", 
            ImmutableMap.builder()
            .put("left", 100)
            .put("top", 100)
            .put("width", 200)
            .put("height", 200)
            .put("direction", "down")
            .put("percent", 3.0)
            .build()
        );

This Worked for me.

0

Thank you, it works also from me, I had the same problem with ImmutableMap

((JavascriptExecutor) driver).executeScript("mobile: scrollGesture", ImmutableMap.of(
        "left", 100, "top", 100, "width", 200, "height", 200,
        "direction", "down",
        "percent", 3.0
    ));
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103