错误:Appium会话已终止

时间:2017-07-19 13:32:18

标签: selenium

我已经在Appium上启动了会话,iOS模拟器加载了;然后appium检查员启动 现在,我在eclipse中运行我的selenium代码,它运行成功。但是当我尝试使用appium检查器检查元素时,会话结束。 另外,我确实添加了“新命令时间”,但它没有用。

这是我收到的消息:enter image description here 错误:会话已被终止

以下是日志: -

[2017-07-19 09:04:23][Appium] Welcome to Appium v1.6.5
[2017-07-19 09:04:23][Appium] Non-default server args:
[2017-07-19 09:04:23][Appium]   address: 127.0.0.1
[2017-07-19 09:04:23][Appium]   logTimestamp: true
[2017-07-19 09:04:23][Appium] Appium REST http interface listener started on 127.0.0.1:4723


[2017-07-19 09:05:12][HTTP] <-- GET /wd/hub/session/4ad54d66-8e97-450f-82a7-333c65826a7b/title 200 11 ms - 83 
[2017-07-19 09:05:12][RemoteDebugger] Checking document readyState
[2017-07-19 09:05:12][RemoteDebugger] Sending javascript command (function (){ return document.readyState; })()
[2017-07-19 09:05:12][RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[2017-07-19 09:05:12][RemoteDebugger] Received applicationSentData response
[2017-07-19 09:05:12][RemoteDebugger] Found data handler for response
[2017-07-19 09:05:12][RemoteDebugger] Received data response from socket send: 'complete'
[2017-07-19 09:05:12][RemoteDebugger] Original command: sendJSCommand
[2017-07-19 09:05:12][RemoteDebugger] readyState was "complete"
[2017-07-19 09:05:12][RemoteDebugger] Page is ready
[2017-07-19 09:05:12][iOS] New page listing is same as old, doing nothing
[2017-07-19 09:05:17][HTTP] --> GET /wd/hub/session/532e6a91-c837-4bf5-acd1-08ba09d69988/source {}
[2017-07-19 09:05:17][MJSONWP] Calling AppiumDriver.getPageSource() with args: ["532e6a91-c837-4bf5-acd1-08ba09d69988"]
[2017-07-19 09:05:17][XCUITest] Executing command 'getPageSource'
[2017-07-19 09:05:17][JSONWP Proxy] Proxying [GET /source] to [GET http://localhost:8100/session/45EB1D20-3547-4558-84E6-EC5441211AFA/source] with no body
[2017-07-19 09:05:17][JSONWP Proxy] Got response with status 200: "{\n  \"value\" : \"Session does not exist\",\n  \"sessionId\" : \"67D07A1C-FC76-4A17-ABEF-F428BFEF207A\",\n  \"status\" : 6\n}"
[2017-07-19 09:05:17][HTTP] <-- GET /wd/hub/session/532e6a91-c837-4bf5-acd1-08ba09d69988/source 404 7 ms - 108 

以下是我的硒代码:

package com.mobile.automation;

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

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;

public class iossample {

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

        DesiredCapabilities cap = new DesiredCapabilities();
        cap.setCapability(CapabilityType.BROWSER_NAME, "Safari");
        cap.setCapability("platformName", "iOS");
        cap.setCapability("platformVersion", "10.3");
        cap.setCapability("deviceName", "iPhone 6s");
        cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "300000");

        URL url = new URL("http://127.0.0.1:4723/wd/hub");
        Thread.sleep(5000);

        IOSDriver<WebElement> driver = new IOSDriver<>(url, cap);
        driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);

        driver.get("https://facebook.com/");
        System.out.println("Page title is: " +driver.getTitle());

    }

}

0 个答案:

没有答案