org.openqa.selenium.SessionNotCreatedException

时间:2016-05-19 10:38:09

标签: java ios selenium

  1. 我收到错误org.openqa.selenium.SessionNotCreatedException: 一旦我执行代码

    包SignUp;

    import java.net.URL; import java.util.concurrent.TimeUnit;进口 org.openqa.selenium.By;进口 org.openqa.selenium.remote.DesiredCapabilities;进口 org.testng.annotations.BeforeT enter code here EST;进口 org.testng.annotations.Test;

    import io.appium.java_client.ios.IOSDriver;

    public class SignUPBaseclass {public IOSDriver driver;
        @BeforeTest public void SignUp1()抛出异常{             DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(" appium-version"," 1.0");             capabilities.setCapability(" platformName"," iOS");             capabilities.setCapability(" platformVersion"," 9.3");             capabilities.setCapability(" deviceName"," iPhone 5S Plus");             capabilities.setCapability(" app"," / Users / sumit / Desktop / Project /FSFosh-1.ipa"); IOSDriver驱动程序=新的IOSDriver(新的 网址(" http://127.0.0.1:4725/wd/hub"),功能);             driver.manage()。timeouts()。implicitlyWait(60,TimeUnit.SECONDS);

                    }
    

    @Test public void Flow(){driver.findElement(By.name("加入我们) !FREE"))点击()。 // AppiumCapabilities App_Cap = new AppiumCapabilities(); //App_Cap.driver.findElement(By.name("JOIN 美国免费!"))。click();

            } /*@AfterClass //public void tearDown()  {     AppiumCapabilities App_Cap = new AppiumCapabilities();  App_Cap.driver.quit(); }*/
    

    }

    错误消息

    [TestNG]跑步:
    /private/var/folders/6r/_2b4t0zj1tj95nkmxmj9c5n40000gp/T/testng-eclipse-2068198674/testng-customsuite.xml

    log4j:WARN找不到记录器的appender (org.apache.http.client.protocol.RequestAddCookies)。 log4j的:WARN 请正确初始化log4j系统。失败的配置: @BeforeTest SignUp1 org.openqa.selenium.SessionNotCreatedException: 无法创建新会话。 (原始错误:请求新的 会话但一个正在进行中)(警告:服务器没有 提供任何堆栈跟踪信息)命令持续时间或超时:469 毫秒构建信息:版本:' 2.53.0',修订版:' 35ae25b', 时间:' 2016-03-15 16:57:40'系统信息:主持人: ' Appster-Sumit-Nagar.local',ip:' 172.16.17.71',os.name:' Mac OS X',os.arch:' x86_64',os.version:' 10.11.3',java.version: ' 1.7.0_80'驱动程序信息:io.appium.java_client.ios.IOSDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(母语 方法)at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)     在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:526)     在 org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)     在 org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)     在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)     在 io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)     在 org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)     在 org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:131)     在 org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:158)     在io.appium.java_client.AppiumDriver。(AppiumDriver.java:109)     在io.appium.java_client.ios.IOSDriver。(IOSDriver.java:23)     at SignUp.SignUPBaseclass.SignUp1(SignUPBaseclass.java:23)at at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)     在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:606)at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)     在 org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)     在 org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)     在 org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)     在org.testng.TestRunner.beforeRun(TestRunner.java:648)at org.testng.TestRunner.run(TestRunner.java:616)at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)at at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)at at org.testng.SuiteRunner.run(SuiteRunner.java:261)at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)at at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)at at org.testng.TestNG.run(TestNG.java:1048)at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:112)at at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)at at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:176)

    SKIPPED:Flow

    ===============================================     默认测试     测试运行:1,失败:0,跳过:1

    配置失败:1,跳过:0

    ===============================================

    默认套件

    总测试运行:1,失败:0,跳过:1配置失败:1,

    跳过:0

    [TestNG] [FailedReporter传递= 0失败= 0跳过= 0]所花费的时间: 194 ms [TestNG] org.testng.reporters.jq.Main@be71839所用的时间: 322 ms [TestNG]所用时间 org.testng.reporters.SuiteHTMLReporter@118e0f0f:119 ms [TestNG] org.testng.reporters.JUnitReportReporter@1f80ce47:21所花费的时间 ms [TestNG] org.testng.reporters.XMLReporter@3f611531所用的时间: 88 ms [TestNG]所用时间 org.testng.reporters.EmailableReporter2@582ed819:8个msenter代码 此处

1 个答案:

答案 0 :(得分:0)

此问题已解决, 在这里我刚创建了#34; RemoteWebDriver"对象而不是IOSDriver ..

public class SignUPBaseclass extends Testbase {
public RemoteWebDriver driver;

@BeforeTest
public RemoteWebDriver SignUp1() throws Throwable  {

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("appium-version", "1.0");
    capabilities.setCapability("platformName", "iOS");
    capabilities.setCapability("platformVersion", "9.3");
    capabilities.setCapability("deviceName", "iPhone 5S Plus");
    capabilities.setCapability("app", "/Users/sumit/Desktop/Project /FSFosh-1.ipa");
     driver = new RemoteWebDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);
    return driver;
}