我在Sauce Labs中运行Java Appium测试需要什么设置?正在获取:SessionNotCreatedException

时间:2019-04-25 07:25:03

标签: java selenium testing appium saucelabs

尝试在Sauce实验室运行Java Appium测试时,我得到

  

org.openqa.selenium.SessionNotCreatedException:无法创建新   远程会话。错误。

     

线程“主”中的异常   org.openqa.selenium.SessionNotCreatedException:无法创建新的   远程会话。所需能力=能力   [{app = http://saucelabs.com/souce-storage/FilePursuit.apk,   platformVersion = 4.4,appiumVersion = 1.5.3,browserName =,   deviceOrientation =肖像,platformName = Android,deviceName =三星   Galaxy S4模拟器}],所需功能=功能[{}]构建   信息:版本:'3.3.1',修订版:'5234b32',时间:'2017-03-10   09:04:52 -0800'系统信息:主机:'CJL-8641',ip:'10 .11.1.245',   os.name:“Windows 10”,os.arch:“ amd64”,os.version:“ 10.0”,   java.version:'1.8.0_201'驱动程序信息:driver.version:AndroidDriver     在   org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)     在   org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)     在   io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89)     在   org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)     在   io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)     在io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)     在   io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)     在   org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)     在   org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:131)     在   org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:144)     在   io.appium.java_client.DefaultGenericMobileDriver。(DefaultGenericMobileDriver.java:38)     在io.appium.java_client.AppiumDriver。(AppiumDriver.java:87)     在io.appium.java_client.AppiumDriver。(AppiumDriver.java:111)     在   io.appium.java_client.android.AndroidDriver。(AndroidDriver.java:72)     在SauceLabsAppiumDemo.main(SauceLabsAppiumDemo.java:34)

     

公共静态最终字符串USERNAME =“ XXXX”;公共静态决赛   字符串ACCESS_KEY =“ XXXX”;公共静态最终字符串URL =“ https://” +   USERNAME +“:” + ACCESS_KEY +“ @ ondemand.saucelabs.com:443 / wb / hub”;

private static AndroidDriver<MobileElement> driver;
public static String id;


AppiumDriverLocalService service;


public static void main(String args[]) throws MalformedURLException{



    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability("deviceName", "Samsung Galaxy S4 Emulator");
    capabilities.setCapability("platformVersion", "4.4");
    capabilities.setCapability("app", "http://saucelabs.com/souce-storage/FilePursuit.apk");
    capabilities.setCapability("browserName", "");
    capabilities.setCapability("deviceOrientation", "portrait");
    capabilities.setCapability("appiumVersion", "1.5.3");

    driver = new AndroidDriver<>(new URL(URL), capabilities);

    driver.quit();
    //System.out.println(we.isDisplayed());
    //System.out.println(we.isEnabled());
    //System.out.println(we.getSize().height+"   "+we.getSize().width);
    //we.click();


    // driver.findElementById("net.one97.paytm:id/first_item_image").click();


}

0 个答案:

没有答案