public void configureAppium() throws MalformedURLException, InterruptedException {
builder = new AppiumServiceBuilder();
builder.withAppiumJS(new File(“C:\Users\sudha\AppData\Roaming\npm\node_modules\appium\build\lib\main.js”))
.withIPAddress(“127.0.0.1”)
.usingPort(4723)
.withTimeout(Duration.ofSeconds(20)).build().start();
service = AppiumDriverLocalService.buildService(builder);
service.start();
System.out.println(“Appium Url:” + service.getUrl());
System.out.println(“Is Server Running:” + service.isRunning());
Thread.sleep(3000);
rb = ResourceBundle.getBundle(“config”);//Read config.properties.
sAssertinFn = new SoftAssert();
UiAutomator2Options options = new UiAutomator2Options();
options.setDeviceName("emulator-5554");
options.setPlatformVersion("14.0");
options.setPlatformName("Android");
options.noReset();
options.setCapability("appium:noReset", false);
options.setCapability("appium:appWaitForLaunch", false);
//****** To call from Emulator
options.setCapability("appPackage", "com.google.android.dialer");
options.setCapability("appActivity", "com.google.android.dialer.extensions.GoogleDialtactsActivity");
options.setAutomationName("UiAutomator2");
options.noSign();
Adriver = new AndroidDriver(new URL("http://0.0.0.0:4723"),options);
Adriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(50));
Thread.sleep(10000);
logger = LogManager.getLogger(this.getClass());
}
The above method executes before class to setup the capabilities.
In Test1, I’m using the below code to click call App
Adriver.findElement(By.xpath(“//android.widget.TextView[@content-desc=‘Phone’]”)).click();
The following error occured upon execution in eclipse console.
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Host info: host: ‘DESKTOP-H290O4K’, ip: ‘192.168.0.147’
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:536)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:268)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:161)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:90)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:102)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:109)
at testBase.BaseTest.configureAppium(BaseTest.java:108)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:69)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:390)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:325)
at org.testng.internal.invokers.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:180)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:122)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:848)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
at org.testng.SuiteRunner.run(SuiteRunner.java:336)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
at org.testng.TestNG.runSuites(TestNG.java:1114)
at org.testng.TestNG.run(TestNG.java:1082)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: org.openqa.selenium.WebDriverException: java.lang.NoSuchMethodException: org.openqa.selenium.remote.ProtocolHandshake.createSession(org.openqa.selenium.remote.http.HttpHandler,java.util.function.Supplier,long)
Build info: version: ‘4.19.1’, revision: ‘abe0ee07dc’
System info: os.name: ‘Windows 11’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.9’
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:137)
at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:102)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:176)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518)
… 32 more
Caused by: java.lang.NoSuchMethodException: org.openqa.selenium.remote.ProtocolHandshake.createSession(org.openqa.selenium.remote.http.HttpHandler,java.util.function.Supplier,long)
at java.base/java.lang.Class.getDeclaredMethod(Class.java:2675)
at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:128)
… 36 more
Anyone , please let me know what causes this issue in opening the call module to make call