TypeError: Can not invoke method

Hi Everyone,

I am new to using Appium Studio. I am trying to automate an iOS application and I have already recorded the steps using the Appium Studio Application.

Now, I am trying to migrate the code produced by Appium Studio in eclipse, so that I can manage the recording in a “page per page” manner. I followed all the steps in the documentation, but when I try to run the script, I am being blocked by this issue:

org.openqa.selenium.WebDriverException: javascript error (javascript error. TypeError: Can not invoke method [jdk.internal.dynalink.beans.SimpleDynamicMethod Map com.experitest.image.agent.appium.backend.commands.browser.AppiumScriptClient.launch(String,boolean,boolean)] with the passed arguments; they do not match any of its method signatures. in <eval> at line number 1)  (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 283 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: 'HKSMBL15029', ip: '10.128.2.16', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_151'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities [{device.majorVersion=10.x, dontGoHomeOnQuit=false, device.os=iOS, noReset=false, dontStopAppOnReset=false, reservationDuration=240, reportFormat=xml, fullReset=false, platform=ANY, desired={bundleId=my.com.ge.mpos, reportDirectory=reports, reportFormat=xml, udid=f768b1016005354f4e2211a09afa7723f8182c2e, platformName=iOS, testName=MPOS-MY}, device.serialNumber=f768b1016005354f4e2211a09afa7723f8182c2e, device.version=10.3.3, automationName=XCUITest, reportDirectory=reports, autoWebview=false, udid=f768b1016005354f4e2211a09afa7723f8182c2e, platformName=iOS, testName=MPOS-MY, device.screenSize=1536x2048, useKeystore=false, device.manufacture=Apple, instrumentApp=false, device.category=TABLET, bundleId=my.com.ge.mpos, autoDismissAlerts=false, reportUrl=C:\Users\roven\appiumstudio-reports\reports\test19, keystorePath=~/.android/debug.keystore, waitForDeviceTimeout=120000, device.model=iPad Pro (9.7-inch), device.name=Terry iPad, projectName=, autoAcceptAlerts=false}]
Session ID: 1caaeb71-f4ec-4edb-ad1f-0e48cd5b75ac
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
	at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
	at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
	at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:577)
	at MPOS_MY.testMPOS_MY(MPOS_MY.java:33)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)

Hopefully, someone can help me to solve this.

Cheers.

can you please share your test code?

which version of Appium studio are you using?

Hi Tom,

Thanks for taking the time to look at this.
I am using Appium Studio Community Edition version 11.2.32.

as for the test code, please see it below:

//package <set your test package>;
import io.appium.java_client.remote.IOSMobileCapabilityType;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.ScreenOrientation;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.By;
import org.junit.*;
import java.net.URL;
import java.net.MalformedURLException;

public class MPOS_MY {
 private String reportDirectory = "reports";
 private String reportFormat = "xml";
 private String testName = "MPOS-MY";
 protected IOSDriver<IOSElement> driver = null;

 DesiredCapabilities dc = new DesiredCapabilities();
 
 @Before
 public void setUp() throws MalformedURLException {
  dc.setCapability("reportDirectory", reportDirectory);
  dc.setCapability("reportFormat", reportFormat);
  dc.setCapability("testName", testName);
  dc.setCapability(MobileCapabilityType.UDID, "******************************************************");
  dc.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "****************************");
  driver = new IOSDriver<IOSElement>(new URL("http://localhost:4723/wd/hub"), dc);
 }
 
 @Test
 public void test********() {
  driver.executeScript("client:client.launch(\"***********")");
  driver.findElement(By.xpath("//*[@class='UIAImage' and ./parent::*[./parent::*[@text='Login']]]"));
  driver.findElement(By.xpath("//*[@text='MPOS Login' and @class='UIAStaticText']"));
  driver.findElement(By.xpath("//*[@placeholder='User ID']"));
  driver.findElement(By.xpath("//*[@placeholder='Password']"));
  driver.findElement(By.xpath("//*[@placeholder='User ID']")).sendKeys("*****");
  driver.findElement(By.xpath("//*[@placeholder='Password']")).sendKeys("*****");
  driver.findElement(By.xpath("//*[@text='Login' and @class='UIAButton']")).click();
 }
 
 @After
 public void tearDown() {
     driver.quit();
 }
}

also, sharing to you my dependencies included in my build.Gradle file:

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
 
repositories {
         
     maven { url "https://cloud.experitest.com/repo" }
     maven { url "http://repo.maven.apache.org/maven2" }
     mavenCentral()
}
dependencies {
    compile group: 'com.experitest', name: 'appium', version:'4.1.2'
    // https://mvnrepository.com/artifact/junit/junit
	testCompile group: 'junit', name: 'junit', version: '4.12'

}

I am using the Appium Studio in Windows 7.

Hi, Everyone.

I just want to ask for update on this. Hopefully someone can help me to resolve this.

Many thanks.

please change the following line :

to :

driver.executeScript(“client:client.launch(“my.com.ge.mpos”,false,false)”);

to learn more about additional commands

https://docs.experitest.com/display/TD/Additional+Commands

1 Like

This worked perfectly. The application is now running.

Many thanks @Tom!

1 Like