我正在尝试通过appium和xcode测试我的网站。每次我启动测试时,都会在终端中收到此错误:
Failure/Error: app = Appium::Driver.new(env[:desired_caps]).start_driver
Selenium::WebDriver::Error::WebDriverError:
和appium输出中的这个错误:
info: [debug] Error: Command failed: /bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version
at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: /bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version\n)","cause":{"killed":true,"code":null,"signal":"SIGTERM","cmd":"/bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version"},"isOperational":true,"killed":true,"code":null,"signal":"SIGTERM","cmd":"/bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version","origValue":"Command failed: /bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version\n"},"sessionId":null}
info: <-- POST /wd/hub/session 500 9640.148 ms - 525
error: Could not determine iOS SDK version
error: Failed to start an Appium session, err was: Error: Command failed: /bin/sh -c xcrun --sdk iphonesimulator --show-sdk-version
这是我的环境文件
ios = {
browser: "safari",
platform: "ios",
type: "mobile",
tag: "ios",
desired_caps: {
caps: {
platformName: 'iOS',
platformVersion: '8.1',
deviceName: 'iPhone 5s',
browserName: 'Safari',
}
}
}
这是我传递的规范:
require './spec/spec_helper'
require './spec/environments'
require 'selenium-webdriver'
require 'appium_lib'
require_relative "../../spec/page_objects/home_page"
@environments.each do |env|
feature "Signing in to ArtWare" do
app = nil
if env[:type] == "computer"
before(:all) do
app = AbstractPage.new(Selenium::WebDriver.for(("#{env[:browser]}").to_sym))
end
elsif env[:type] == "mobile"
before(:all) do
app = Appium::Driver.new(env[:desired_caps]).start_driver
Appium.promote_appium_methods Object
end
end
it "In #{env[:platform]} app should let user in with a valid account and password", "#{env[:tag]}".to_sym do
signInConfirmation = app
.navigateToAppRoot
.navigateToSignIn
.fillInEmail('murat@breakthrough.com')
.fillInPassword('asdfasdf')
.submitSignInForm
notice = signInConfirmation.getNoticeConfimation
expect(notice).to eq('Signed in successfully.')
end
it "In #{env[:platform]} app should let user logout" do
logoutConfirmation = app.logoutUser
notice = logoutConfirmation.getNoticeConfimation
expect(notice).to eq('Signed out successfully.')
end
it "In #{env[:platform]} app should not let use in with an invalid account", "#{env[:tag]}".to_sym do
invalidEmailAlert = app
.navigateToAppRoot
.navigateToSignIn
.fillInEmail('invalid@breakthrough.com')
.fillInPassword('asdfasdf')
.submitInvalidSignInForm
alert = invalidEmailAlert.getInvalidSignInAlert
expect(alert).to eq("Invalid email or password.")
end
it "In #{env[:platform]} app should not let user in with an invalid password", "#{env[:tag]}".to_sym do
invalidEmailAlert = app
.navigateToAppRoot
.navigateToSignIn
.fillInEmail('murat@breakthrough.com')
.fillInPassword('incorrect')
.submitInvalidSignInForm
alert = invalidEmailAlert.getInvalidSignInAlert
expect(alert).to eq("Invalid email or password.")
end
after(:all) do
app.quit
end
end
end