2

I've set up a Mac-Mini with java, Xcode 5 with iOS simulators for iOS 7. I want to use the iOS-driver (http://ios-driver.github.io/ios-driver/) for Selenium to run automated tests. But the driver doesn't start the Safari. The connection succeeds, the simulator starts, but then I get a timeout after 60 seconds. How can I fix this?

Start of of driver:

sudo ios-server-0.6.5-jar-with-dependencies.jar -simulator

Output:

59:54:792 INFO ApplicationStore.<init>  App archive folder:/Users/macbuildserver/Development/selenium/applications
59:55:415 WARNING AppleLanguage.create  no isn't recognized.Please file a bug on github.You won't be able to start the app in that language.
59:56:264 WARNING AppleLanguage.create  zh_CN isn't recognized.Please file a bug on github.You won't be able to start the app in that language.
59:56:277 WARNING AppleLanguage.create  zh_TW isn't recognized.Please file a bug on github.You won't be able to start the app in that language.
59:56:294 INFO IOSServer.init  
Beta features enabled ( enabled by -beta flag ): false
Simulator enabled ( enabled by -simulators flag): true
Inspector: http://0.0.0.0:5555/inspector/
tests can access the server at http://0.0.0.0:5555/wd/hub
server status: http://0.0.0.0:5555/wd/hub/status
Connected devices: http://0.0.0.0:5555/wd/hub/devices/all
Applications: http://0.0.0.0:5555/wd/hub/applications/all
Capabilities: http://0.0.0.0:5555/wd/hub/capabilities/all
Monitoring '/Users/macbuildserver/Development/selenium/applications' for new applications
Archived apps /Users/macbuildserver/Development/selenium/applications
using xcode install : /Applications/Xcode.app
using IOS version 7.0
ios >= 6.0. Safari and hybrid apps are supported.

Applications :
--------------- 
    CFBundleName=Safari,CFBundleVersion=9537.53

2013-11-14 06:59:56.294:INFO::jetty-7.x.y-SNAPSHOT
2013-11-14 06:59:56.357:INFO::Started SelectChannelConnector@0.0.0.0:5555

http://:5555/wd/hub/status:

{
  "class": "org.openqa.selenium.remote.Response",
  "hCode": 1228764147,
  "sessionId": null,
  "state": null,
  "status": 0,
  "value": {
    "build": {
      "revision": "120cf4311807e2e137e519f4c4877cf6340d0cbc",
      "time": "20130927-1435",
      "version": "0.6.5"
    },
    "ios": {"simulatorVersion": "7.0"},
    "java": {"version": "1.7.0_45"},
    "os": {
      "arch": "x86_64",
      "name": "Mac OS X",
      "version": "10.8.5"
    },
    "state": "success",
    "supportedApps": [{
      "CFBundleDevelopmentRegion": "English",
      "CFBundleDisplayName": "Safari",
      "CFBundleExecutable": "MobileSafari",
      "CFBundleIcons": {"CFBundlePrimaryIcon": {
        "CFBundleIconFiles": [
          "icon-spotlight~ipad.png",
          "icon-table~ipad.png",
          "icon-about~ipad.png",
          "icon-table~ipad.png",
          "icon-spotlight@2x.png",
          "icon-table@2x.png",
          "icon~ipad.png",
          "icon-about@2x.png",
          "icon@2x~iphone.png",
          "icon@2x~ipad.png"
        ],
        "UIPrenderedIcon": true
      }},
      "CFBundleIdentifier": "com.apple.mobilesafari",
      "CFBundleInfoDictionaryVersion": "6.0",
      "CFBundlePackageType": "APPL",
      "CFBundleShortVersionString": "7.0",
      "CFBundleSignature": "????",
      "CFBundleSupportedPlatforms": ["iPhoneSimulator"],
      "CFBundleURLTypes~ipad": [
        {
          "CFBundleURLIsPrivate": true,
          "CFBundleURLName": "Web App URL",
          "CFBundleURLSchemes": ["webclip"]
        },
        {
          "CFBundleURLName": "Web site URL",
          "CFBundleURLSchemes": [
            "http",
            "https"
          ]
        },
        {
          "CFBundleURLName": "FTP URL",
          "CFBundleURLSchemes": ["ftp"]
        },
        {
          "CFBundleURLName": "Web Search URL",
          "CFBundleURLSchemes": ["x-web-search"]
        },
        {
          "CFBundleURLIsPrivate": true,
          "CFBundleURLName": "MobileSafari Tab URL",
          "CFBundleURLSchemes": ["com-apple-mobilesafari-tab"]
        }
      ],
      "CFBundleURLTypes~iphone": [
        {
          "CFBundleURLIsPrivate": true,
          "CFBundleURLName": "Web App URL",
          "CFBundleURLSchemes": ["webclip"]
        },
        {
          "CFBundleURLName": "Web site URL",
          "CFBundleURLSchemes": [
            "http",
            "https"
          ]
        },
        {
          "CFBundleURLName": "Radar URL",
          "CFBundleURLSchemes": [
            "rdar",
            "radar"
          ]
        },
        {
          "CFBundleURLName": "FTP URL",
          "CFBundleURLSchemes": ["ftp"]
        },
        {
          "CFBundleURLName": "Web Search URL",
          "CFBundleURLSchemes": ["x-web-search"]
        },
        {
          "CFBundleURLIsPrivate": true,
          "CFBundleURLName": "MobileSafari Tab URL",
          "CFBundleURLSchemes": ["com-apple-mobilesafari-tab"]
        }
      ],
      "CFBundleURLTypes~ipod": [
        {
          "CFBundleURLIsPrivate": true,
          "CFBundleURLName": "Web App URL",
          "CFBundleURLSchemes": ["webclip"]
        },
        {
          "CFBundleURLName": "Web site URL",
          "CFBundleURLSchemes": [
            "http",
            "https"
          ]
        },
        {
          "CFBundleURLName": "Radar URL",
          "CFBundleURLSchemes": [
            "rdar",
            "radar"
          ]
        },
        {
          "CFBundleURLName": "FTP URL",
          "CFBundleURLSchemes": ["ftp"]
        },
        {
          "CFBundleURLName": "Web Search URL",
          "CFBundleURLSchemes": ["x-web-search"]
        },
        {
          "CFBundleURLIsPrivate": true,
          "CFBundleURLName": "MobileSafari Tab URL",
          "CFBundleURLSchemes": ["com-apple-mobilesafari-tab"]
        }
      ],
      "CFBundleVersion": "9537.53",
      "DTPlatformName": "iphonesimulator",
      "DTSDKName": "iphonesimulator7.0",
      "LSRequiresIPhoneOS": true,
      "MallocBehavior": {"NanoAllocator": false},
      "SBMatchingApplicationGenres": [
        "Productivity",
        "Utilities"
      ],
      "SBUsesNetwork": 3,
      "SafariProductVersion": "7.0",
      "UIApplicationDisableLegacyAutorotationKey": true,
      "UIBackgroundModes": [
        "audio",
        "continuousFallback"
      ],
      "UIBackgroundStyle": "UIBackgroundStyleDarkBlur",
      "UIDeviceFamily": [2],
      "UIHasPrefs": true,
      "UIStatusBarTintParameters": {"UINavigationBar": {"Style": "UIBarStyleDefault"}},
      "UISupportedInterfaceOrientations": [
        "UIInterfaceOrientationPortrait",
        "UIInterfaceOrientationLandscapeLeft",
        "UIInterfaceOrientationLandscapeRight"
      ],
      "UISupportedInterfaceOrientations~ipad": [
        "UIInterfaceOrientationPortrait",
        "UIInterfaceOrientationLandscapeLeft",
        "UIInterfaceOrientationLandscapeRight",
        "UIInterfaceOrientationPortraitUpsideDown"
      ],
      "UIViewControllerBasedStatusBarAppearance": true,
      "applicationPath": "/var/root/.ios-driver/safariCopies/safari-7.0.app",
      "device": "ipad",
      "deviceAlt": ["ipad"],
      "device_Alt": [
        "iphone",
        "ipad"
      ],
      "resources": {"CFBundleIconFile": "/wd/hub/resources/hash=2134756163"},
      "sdkVersion": "7.0",
      "sdkVersion_Alt": [
        "5.0",
        "5.1",
        "6.0",
        "6.1"
      ],
      "simulator": true,
      "supportedLanguages": [
        "hr",
        "ro",
        "ca",
        "vi",
        "tr",
        "fr",
        "unknown",
        "hu",
        "unknown",
        "th",
        "id",
        "pt-PT",
        "en-GB",
        "fi",
        "unknown",
        "sv",
        "it",
        "sk",
        "ja",
        "uk",
        "es",
        "da",
        "ms",
        "ko",
        "ar",
        "he",
        "en",
        "nl",
        "cs",
        "el",
        "pl",
        "pt",
        "ru",
        "de"
      ],
      "timeHack": false,
      "variation": "Regular"
    }]
  }
}

Test code (C#):

var cap = new DesiredCapabilities();
cap.SetCapability("version", "7.0");
cap.SetCapability("device", "ipad");
cap.SetCapability("CFBundleName", "Safari");
//var cap = DesiredCapabilities.IPad(); // doesn't work
using (var driver = new RemoteWebDriver(new Uri("http://<ip>:5555/wd/hub"), cap))
{
    driver.Navigate().GoToUrl("http://www.google.com");
    Console.ReadKey();
}
4

1 回答 1

0

您是否尝试过使用重构分支中最新的 ios-driver 代码?我遇到了类似的问题,使用这个分支的最新代码解决了我机器上的问题。

我还必须更改 iPhone 模拟器目录中的一些额外权限:

sudo chmod a+rw /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/Applications
sudo chmod -R a+rw /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/Applications/MobileSafari.app

请在 ios-driver github 页面上查看此问题以获取更多详细信息:https ://github.com/ios-driver/ios-driver/issues/163#issuecomment-27023286

于 2013-11-25T18:42:42.183 回答