Appium`get`命令无法在iOS真实设备上运行

时间:2018-01-05 17:18:50

标签: ios automation appium

我使用Appium / Ruby自动化测试。

我的测试运行以下步骤:

  • 启动应用
  • 做点什么
  • 启动浏览器
  • 返回应用

在模拟器上,测试工作正常但是当我在iOS真实设备上尝试时,当我尝试打开浏览器时出现错误。 更具体地说,我在以下代码行中收到错误:

driver.get('https://www.google.com')

错误:

An unknown server-side error occurred while processing the command. Original error: Failed to open https://www.google.com (Selenium::WebDriver::Error::UnknownError)

我错过了什么?

更新

iOS设备版

iPAD air 2

驱动程序初始化

Appium::Driver.new(desired_caps, true)
Appium.promote_appium_methods AppiumWorld

World do
  AppiumWorld.new
end  

Before do
  puts 'Starting app'
$driver.start_driver
end

After do
  puts 'Closing app'
  $driver.driver_quit
end

功能

desired_caps = {
  caps: {
    platformName: 'ios',
    platformVersion: platform_version,
    app: app_path,
    automationName: 'XCUITest',
    showXcodeLog: true,
    xcodeSigningId: 'iPhone Developer',
    xcodeOrgId: TEAM_ID,
    udid: target_device,
    deviceName: device_name_from_uuid(target_device)
  },
  appium_lib: {
    sauce_username:   nil,
    sauce_access_key: nil,
    wait: 60
  }
}

错误期间运行的代码

Then /^I navigate to a url$/ do
  puts 'one'
  driver.get('https://www.google.com')
  puts 'two'
  screen_tap(x: 5, y: 5)
end

我使用puts来确保错误发生在get函数

appium logs

...
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"A9B8A2FF-EC7A-4D3F-94ED-F66DEC7D3099"}
[info] [HTTP] <-- POST /wd/hub/session/085765a8-6817-4576-b322-932129f5cc39/element 200 707 ms - 122 
[info] [HTTP] --> GET /wd/hub/session/085765a8-6817-4576-b322-932129f5cc39/element/A9B8A2FF-EC7A-4D3F-94ED-F66DEC7D3099/displayed {}
[info] [MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [XCUITest] Executing command 'proxyReqRes'
[debug] [JSONWP Proxy] Proxying [GET /wd/hub/session/085765a8-6817-4576-b322-932129f5cc39/element/A9B8A2FF-EC7A-4D3F-94ED-F66DEC7D3099/displayed] to [GET http://localhost:8100/session/27B676CB-BD0D-4810-8BEA-305D376CDA7F/element/A9B8A2FF-EC7A-4D3F-94ED-F66DEC7D3099/displayed] with body: {}[debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : true,\n  \"sessionId\" : \"27B676CB-BD0D-4810-8BEA-305D376CDA7F\",\n  \"status\" : 0\n}"
[info] [JSONWP Proxy] Replacing sessionId 27B676CB-BD0D-4810-8BEA-305D376CDA7F with 085765a8-6817-4576-b322-932129f5cc39
[info] [HTTP] <-- GET /wd/hub/session/085765a8-6817-4576-b322-932129f5cc39/element/A9B8A2FF-EC7A-4D3F-94ED-F66DEC7D3099/displayed 200 741 ms - 76 
[info] [HTTP] --> POST /wd/hub/session/085765a8-6817-4576-b322-932129f5cc39/url {"url":"https://www.google.com"}
[debug] [MJSONWP] Calling AppiumDriver.setUrl() with args: ["https://www.google.com","085765a8-6817-4576-b322-932129f5cc39"]
[debug] [XCUITest] Executing command 'setUrl'
[debug] [JSONWP Proxy] Proxying [POST /url] to [POST http://localhost:8100/session/27B676CB-BD0D-4810-8BEA-305D376CDA7F/url] with body: {"url":"https://www.google.com"}
[debug] [JSONWP Proxy] Got response with status 200: {"value":"Failed to open https://www.google.com","sessionId":"27B676CB-BD0D-4810-8BEA-305D376CDA7F","status":13}
[info] [HTTP] <-- POST /wd/hub/session/085765a8-6817-4576-b322-932129f5cc39/url 500 32 ms - 208 
[info] [HTTP] --> DELETE /wd/hub/session/085765a8-6817-4576-b322-932129f5cc39 {}
[debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["085765a8-6817-4576-b322-932129f5cc39"]
[debug] [BaseDriver] Event 'quitSessionRequested' logged at 1515412128915 (11:48:48 GMT+0000 (WET))
[info] [Appium] Removing session 085765a8-6817-4576-b322-932129f5cc39 from our master session list
[debug] [JSONWP Proxy] Proxying [DELETE /session/085765a8-6817-4576-b322-932129f5cc39] to [DELETE http://localhost:8100/session/27B676CB-BD0D-4810-8BEA-305D376CDA7F] with no body[debug] [JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n\n  },\n  \"sessionId\" : \"61BE4616-D448-4D77-B5AD-04497F39EC6C\",\n  \"status\" : 0\n}"
[info] [XCUITest] Setting '755' permissions to '/Users/user_name/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Logs/Test/Attachments' folder
[debug] [XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] [iOSLog] Stopping iOS log capture
[debug] [BaseDriver] Event 'quitSessionFinished' logged at 1515412129288 (11:48:49 GMT+0000 (WET))
[debug] [MJSONWP] Received response: null
[debug] [MJSONWP] But deleting session, so not returning
[debug] [MJSONWP] Responding to client with driver.deleteSession() result: null
[info] [HTTP] <-- DELETE /wd/hub/session/085765a8-6817-4576-b322-932129f5cc39 200 374 ms - 76 [debug] [XCUITest] Connection to WDA timed out
[debug] [iProxy] recv failed: Operation not permitted

0 个答案:

没有答案