-0.4 C
New York
Saturday, February 22, 2025

Exception in thread “essential” org.openqa.selenium.SessionNotCreatedException: Couldn’t begin a brand new session. Selenium connecting with Appium server


Exception in thread “essential” org.openqa.selenium.SessionNotCreatedException: Couldn’t begin a brand new session. Attainable causes are invalid handle of the distant server or browser start-up failure.
Host data: host: ‘XXXXX’, ip: ‘XXXXX’
Construct data: model: ‘4.26.0’, revision: ’69f9e5e’
System data: os.title: ‘Home windows 11’, os.arch: ‘amd64’, os.model: ‘10.0’, java.model: ‘23.0.1’
Driver data: io.appium.java_client.android.AndroidDriver
Command: [null, newSession {capabilities=[Capabilities {app: C:UsersxxxxxxOneDriveDoc…, appActivity: app.superssmart.ui.MainActi…, appPackage: app.superssmart, browserName: , deviceName: emulator-5554, noReset: true, platformName: ANDROID}]}]
Capabilities {app: C:UsersxxxxOneDriveDoc…, appActivity: app.superssmart.ui.MainActi…, appPackage: app.superssmart, browserName: , deviceName: emulator-5554, noReset: true, platformName: ANDROID}
at org.openqa.selenium.distant.RemoteWebDriver.execute(RemoteWebDriver.java:563)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:270)
at org.openqa.selenium.distant.RemoteWebDriver.(RemoteWebDriver.java:174)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:91)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:103)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:109)
at appium.check.App_Main.essential(App_Main.java:29)
Brought on by: java.lang.IllegalArgumentException: Unlawful key values seen in w3c capabilities: [app, appActivity, appPackage, deviceName, noReset]
at org.openqa.selenium.distant.NewSessionPayload.lambda$validate$5(NewSessionPayload.java:163)
at java.base/java.util.stream.ReferencePipeline$15$1.settle for(ReferencePipeline.java:580)
at java.base/java.util.stream.ReferencePipeline$15$1.settle for(ReferencePipeline.java:581)
at java.base/java.util.stream.ReferencePipeline$3$1.settle for(ReferencePipeline.java:215)
at java.base/java.util.stream.ReferencePipeline$15$1.settle for(ReferencePipeline.java:581)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1709)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.consider(AbstractPipeline.java:265)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:636)
at org.openqa.selenium.distant.NewSessionPayload.validate(NewSessionPayload.java:167)
at org.openqa.selenium.distant.NewSessionPayload.(NewSessionPayload.java:70)
at org.openqa.selenium.distant.NewSessionPayload.create(NewSessionPayload.java:99)
at org.openqa.selenium.distant.NewSessionPayload.create(NewSessionPayload.java:84)
at org.openqa.selenium.distant.ProtocolHandshake.createSession(ProtocolHandshake.java:60)
at io.appium.java_client.distant.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:176)
at io.appium.java_client.distant.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
at org.openqa.selenium.distant.RemoteWebDriver.execute(RemoteWebDriver.java:545)
… 6 extra

Code:
public static AndroidDriver driver;

public static void essential(String[] args) throws MalformedURLException, InterruptedException {
    File appDir = new File("C:CustomerskeertOneDrivePaperworkApp");
    File app=new File(appDir,"app.apk");
    DesiredCapabilities cap=new DesiredCapabilities();
    cap.setCapability(CapabilityType.BROWSER_NAME, "");
    cap.setCapability("platformName", "Android");
    cap.setCapability("app", app.getAbsolutePath());
    cap.setCapability("deviceName", "emulator-5554");
    cap.setCapability("appPackage", "app.superssmart");
    cap.setCapability("appActivity", "app.superssmart.ui.MainActivity");
    cap.setCapability("noReset", true);

    driver=new AndroidDriver(new URL("http://127.0.0.1:4723/"),cap);

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles