加载Appium XCUITEST驱动程序

时间:2016-11-20 18:51:44

标签: ios appium appium-ios

我真的被困住了,任何帮助都会受到赞赏......

我安装了最新的服务器版本(1.6.0)。 当我检查服务器版本时,它是正常的......

Asis-Mac-mini:/ asihizkiahu $ appium -v 1.6.0

  • 观察附加日志中的服务器版本,它表示Appium v​​1.6.0-beta1(错误版本) 这会导致错误吗?
  • 我收到错误......

    [MJSONWP]遇到内部错误运行命令:错误:无法导航到webview;没有!

使用错误的服务器登录:

[node, /Users/asihizkiahu/node_modules/appium/build/lib/main.js, --address, 127.0.0.1, --port, 4723]
Appium server started.
(node:13191) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[Appium] Welcome to Appium v1.6.0-beta1
[Appium] Non-default server args:
[Appium] address: '127.0.0.1'
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
Trying to set IOS driver
Property file src/test/resources/messaging_sanity_test/capabilities.properties parsed successfully

[MJSONWP] Encountered internal error running command: Error: Could not navigate to webview; there are none!

以下是包含错误的日志的一部分:

[debug] [RemoteDebugger] Receiving data from remote debugger: '{"argument":{"WIRApplicationDictionaryKey":{}},"selector":"rpcreportConnectedApplicationList:"}'
[debug] [RemoteDebugger] Received no apps from remote debugger. Unable to connect.
[debug] [RemoteDebugger] Receiving data from remote debugger: '{"argument":{"WIRDriverDictionaryKey":{}},"selector":"rpcreportConnectedDriverList:"}'
[debug] [RemoteDebugger] Notified of connected drivers: {}.
[debug] [RemoteDebugger] Connected to application
[debug] [RemoteDebugger] Sim name: iPhone
[debug] [RemoteDebugger] Sim build: 14A345
[debug] [RemoteDebugger] Sim platform version: 10.0
[debug] [RemoteDebugger] Selecting application
[debug] [RemoteDebugger] No applications currently connected.
[debug] [iOS] No web frames found.
[iOS] Could not find any webviews yet, refreshing/retrying
[debug] [iOS] Retrieving contexts and views
[debug] [iOS] Selecting by url: false 
[debug] [RemoteDebugger] useNewSafari --> false
[debug] [RemoteDebugger] Debugger socket connected to ::1:27753
[debug] [RemoteDebugger] Sending connection key request
[debug] [RemoteDebugger] Sending 'rpcreportIdentifier:' message to remote debugger
[debug] [RemoteDebugger] Receiving data from remote debugger: '{"argument":{"WIRSimulatorBuildKey":"14A345","WIRSimulatorProductVersionKey":"10.0","WIRSimulatorNameKey":"iPhone"},"selector":"rpcreportSetup:"}'
[debug] [RemoteDebugger] Received response from socket send: '["iPhone","14A345","10.0"]'
[debug] [RemoteDebugger] Receiving data from remote debugger: '{"argument":{"WIRApplicationDictionaryKey":{}},"selector":"rpcreportConnectedApplicationList:"}'
[debug] [RemoteDebugger] Received no apps from remote debugger. Unable to connect.
[debug] [RemoteDebugger] Connected to application
[debug] [RemoteDebugger] Sim name: iPhone
[debug] [RemoteDebugger] Sim build: 14A345
[debug] [RemoteDebugger] Sim platform version: 10.0
[debug] [RemoteDebugger] Selecting application
[debug] [RemoteDebugger] No applications currently connected.
[debug] [iOS] No web frames found.
[XCUITest] Error: Could not navigate to webview; there are none!
at XCUITestDriver.spinHandles$ (lib/commands/context.js:506:13)
at tryCatch (/Users/asihizkiahu/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as next
at GeneratorFunctionPrototype.invoke (/Users/asihizkiahu/node_modules/babel-runtime/regenerator/runtime.js:136:37)
Error: Could not navigate to webview; there are none!
at XCUITestDriver.spinHandles$ (lib/commands/context.js:506:13)
at tryCatch (/Users/asihizkiahu/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as next
at GeneratorFunctionPrototype.invoke (/Users/asihizkiahu/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[JSONWP Proxy] Proxying [DELETE /session/34948802-75b5-4ee5-922f-20b4b658fa18] to [DELETE http://localhost:8100/session/E545A2AC-EB6F-4BD1-A419-DB6CF7B04987] with no body
[debug] [RemoteDebugger] Receiving data from remote debugger: '{"argument":{"WIRDriverDictionaryKey":{}},"selector":"rpcreportConnectedDriverList:"}'
[debug] [RemoteDebugger] Notified of connected drivers: {}.
[JSONWP Proxy] Got response with status 200: "{\n \"value\" : {\n\n },...
[XCUITest] Shutting down WebDriverAgent
[XCUITest] Simulator log exited with code 'null'
[XCUITest] xcodebuild exited with code 'null' and signal 'SIGTERM'
[debug] [XCUITest] Running iOS simulator reset flow
[debug] [XCUITest] Shutting down simulator
[debug] [iOSSim] Killing all iOS Simulators
[debug] [XCUITest] Full reset is on. Cleaning simulator
[debug] [iOSSim] Killing any simulator daemons for 5A494E7A-EE78-4095-8922-CF1C3CC89FAB
[iOSSim] Cleaning simulator 5A494E7A-EE78-4095-8922-CF1C3CC89FAB
[debug] [XCUITest] Resetting simulator
[debug] [XCUITest] Shutting down simulator
[debug] [iOSSim] Killing all iOS Simulators
[debug] [iOSLog] Stopping iOS log capture
[MJSONWP] Encountered internal error running command: Error: Could not navigate to webview; there are none!
at XCUITestDriver.spinHandles$ (lib/commands/context.js:506:13)
at tryCatch (/Users/asihizkiahu/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as next
at GeneratorFunctionPrototype.invoke (/Users/asihizkiahu/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session 500 305866 ms - 183 
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not navigate to webview; there are none! (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 306.28 seconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'Asis-Mac-mini.local', ip: '192.168.1.194', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.7.0_79'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:158)
at com.ui.service.drivers.Drivers$Appium.createIOSDriver(Drivers.java:474)
at com.ui.service.drivers.Drivers$Appium.setDriver(Drivers.java:420)
at com.ui.service.drivers.Drivers.setDriver(Drivers.java:59)
at com.test.BaseTest$StaticRouter.before(BaseTest.java:80)
at appium.messaging.MessagingSanityTest.setUp(MessagingSanityTest.java:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)

1 个答案:

答案 0 :(得分:0)

我的目标是通过代码加载Appium服务器(版本1.6.0),并加载XCUITEST驱动程序。

我的代码是......

Appium服务器负载:

public static void startServer() {

        CommandLine command = new CommandLine(
                "node");
        command.addArgument(
                "/Users/asihizkiahu/node_modules/appium/build/lib/main.js",
                false);
        command.addArgument("--address", false);
        command.addArgument("127.0.0.1");
        command.addArgument("--port", false);
        command.addArgument("4723");
//        command.addArgument("---no-reset", true);
        DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
        DefaultExecutor executor = new DefaultExecutor();
        executor.setExitValue(1);
        try {
            ColorLog.println(ColorLog.Level.DEBUG, command.toString());
            executor.execute(command, resultHandler);
            Thread.sleep(10000);
            System.out.println("Appium server started.");
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

驱动程序加载:

public class AppiumIOS {
 private final static Logger logger = Logger.getLogger(AppiumIOS.class);
 static WebDriver driver;

 public static void main(String[] args) throws MalformedURLException, InterruptedException {
  String hubUrl = "http://127.0.0.1:4723/wd/hub";
  String iOSDeviceName = "iPhone Simulator";
  String iOSVersion = "10.0";

  DesiredCapabilities capabilities = new DesiredCapabilities();
  capabilities.setCapability("deviceName", iOSDeviceName);
  capabilities.setCapability("platformName", "iOS");
  capabilities.setCapability("platformVersion", iOSVersion);
  capabilities.setCapability("app", /Users/asihizkiahu/Library/Developer/Xcode/DerivedData/Vi-chglmmqrkfgvuoflipawibkmabgs/Build/Products/Debug-iphonesimulator/Vi-Dev.app);
  capabilities.setCapability("automationName", "XCUITest");
  driver = new RemoteWebDriver(new URL(hubUrl), capabilities);


 }