简体   繁体   English

Appium _org.openqa.selenium.SessionNotCreatedException

[英]Appium _org.openqa.selenium.SessionNotCreatedException

我的项目结构和apk位置的图像

I am running appium script , for android app. 我正在为Android应用程序运行appium脚本。

But it is not at all running. 但是它根本没有运行。

I have added all the dependency in my maven project required to run the test. 我已经在我的Maven项目中添加了运行测试所需的所有依赖项。

Adding all of my code below. 在下面添加我的所有代码。

Please check and help me. 请检查并帮助我。

Launch Class 发射班

      package TestCases.Project_Entry;

    import java.io.File;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.concurrent.TimeUnit;

    import org.openqa.selenium.remote.DesiredCapabilities;
    import org.testng.annotations.BeforeSuite;
    import org.testng.annotations.BeforeTest;
    import org.testng.annotations.Test;

    import io.appium.java_client.android.AndroidDriver;
    import io.appium.java_client.android.AndroidElement;
    import io.appium.java_client.remote.MobileCapabilityType;

    public class launch {

        AndroidDriver<AndroidElement> driver;

        public AndroidDriver<AndroidElement> capabilities() throws MalformedURLException {

            // TODO Auto-generated method stub
            File appDir = new File("src");
            File app = new File(appDir, "app-staging-debug.apk");
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());

            capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Palak");
            capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator2");
            capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "25");
            capabilities.setCapability("autoGrantPermissions", true);

            capabilities.setCapability("--session-override", true);
            driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
            driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

            return driver;
        }

    }
  1. I have already tried , re-starting eclipse. 我已经尝试过,重新开始蚀。
  2. Adding automation name as ui automator 2 将自动化名称添加为ui automator 2
    package TestCases.Project_Entry;

    import java.io.IOException;
    import java.net.MalformedURLException;

    import org.openqa.selenium.remote.RemoteWebDriver;
    import org.testng.annotations.*;

    import PageObject.loginObjects;
    import io.appium.java_client.android.AndroidDriver;
    import io.appium.java_client.android.AndroidElement;

        public class loginTestCases extends launch {
            AndroidDriver<AndroidElement> driver;

            @BeforeTest
        public void openapp() throws MalformedURLException {
            capabilities();
        }



        @Test
        public void log() {


            driver.findElementById("versionx.entryPoint:id/ed_verificationEmail").sendKeys("213214");

        }

    }

Error Showing:- 错误显示:

>[RemoteTestNG] detected TestNG version 7.0.0
FAILED CONFIGURATION: @BeforeTest openapp
org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original 


>===============================================
    Default test
    Tests run: 1, Failures: 0, Skips: 1
    Configuration Failures: 1, Skips: 0
===============================================



>===============================================
Default suite
Total tests run: 1, Passes: 0, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 0
===============================================

I think you need to add a capability. 我认为您需要添加一项功能。

capabilities.setCapability("appWaitActivity", "*");

Also re-check APK path 还要重新检查APK路径

只是为了消除这种可能性,将您的应用程序放在桌面上并从那里添加路径,它将被硬编码,但这只是为了确保应用程序路径不是问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.openqa.selenium.SessionNotCreatedException 与 Appium - org.openqa.selenium.SessionNotCreatedException with Appium org.openqa.selenium.SessionNotCreatedException - org.openqa.selenium.SessionNotCreatedException org.openqa.selenium.SessionNotCreatedException - org.openqa.selenium.SessionNotCreatedException Appium \\ MAC OS \\ Android \\ Java-org.openqa.selenium.SessionNotCreatedException - Appium \ MAC OS \ Android \ Java - org.openqa.selenium.SessionNotCreatedException SeleniumError:org.openqa.selenium.SessionNotCreatedException - SeleniumError : org.openqa.selenium.SessionNotCreatedException Appium 错误:线程“main”org.openqa.selenium.SessionNotCreatedException 中的异常:无法创建新的远程会话 - Appium Error :Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session 如何解决org.openqa.selenium.SessionNotCreatedException硒网格3 - How to solve org.openqa.selenium.SessionNotCreatedException selenium grid 3 org.openqa.selenium.SessionNotCreatedException:无法找到匹配的功能集 - org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities org.openqa.selenium.SessionNotCreatedException:会话未为Chrome创建异常 - org.openqa.selenium.SessionNotCreatedException: session not created exception for Chrome org.openqa.selenium.SessionNotCreatedException:所需功能错误 - org.openqa.selenium.SessionNotCreatedException: desired capabilities error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM