使用最新的 appium 版本与我完全配置的 iOS 7 设备进行通信。
我可以让 Webdriver 构建并与我的 appium 服务器对话。
我可以让 SafariLauncher 从 xcode 构建并在我的设备上运行。
但是,当我尝试使用我的 java 代码来使用 appium 服务器调用 SafariLauncher 并在我的设备上运行它时,我得到以下“uncaughtException”
我试过让 appium 使用它自己的 SafariLauncher 版本,但我得到了一个稍微不同但同样阻塞的错误,指出“无法创建新会话”。将所需功能切换到我自己本地构建的 SafariLauncher.app 版本后,我收到了新的“uncaughtException”错误。
*info: Welcome to Appium v0.14.2
info: Appium REST http interface listener started on 0.0.0.0:3001
info - socket.io started
info: Spawning instruments force-quitting watcher process
info: [FQInstruments] Force quit unresponsive instruments v0.0.1
info: Responding to client with success: {"status":0,"value":{"build":{"version":"0.14.2","revision":"113e796b850b28e7066fe472faf8554b73b6299d"}}}
debug: Appium request initiated at /wd/hub/status
GET /wd/hub/status 200 8ms - 144b
debug: Request received with params: {}
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"app":"/Users/accesso/Library/Developer/Xcode/DerivedData/SafariLauncher-cquscfvgyludjdaolkpikgbmowez/Build/Products/Debug-iphoneos/SafariLauncher.app","device":"iphone"}}
info: Using local app from desiredCaps: /Users/accesso/Library/Developer/Xcode/DerivedData/SafariLauncher-cquscfvgyludjdaolkpikgbmowez/Build/Products/Debug-iphoneos/SafariLauncher.app
info: Creating new appium session a84fee15-6d72-41d2-8ebb-4c8860455c2a
info: Removing any remaining instruments sockets
info: Cleaned up instruments socket /tmp/instruments_sock
warn: Could not parse plist file at /Users/accesso/Library/Developer/Xcode/DerivedData/SafariLauncher-cquscfvgyludjdaolkpikgbmowez/Build/Products/Debug-iphoneos/SafariLauncher.app/en.lproj/Localizable.strings
info: Not setting locale because we're using a real device
info: Not setting iOS and app preferences since we're on a real device
info: Starting iOS device log capture via idevicesyslog
info: Not setting device type since we're connected to a device
error: uncaughtException: undefined date=Thu Feb 06 2014 10:17:25 GMT-0500 (EST), pid=3350, uid=501, gid=20, cwd=/Applications/Appium.app/Contents/Resources/node_modules/appium, execPath=/Applications/Appium.app/Contents/Resources/node/bin/node, version=v0.10.17, argv=[/Applications/Appium.app/Contents/Resources/node/bin/node, /Applications/Appium.app/Contents/Resources/node_modules/appium/lib/server/main.js, --port, 3001, --app, /, --udid, 7cc3dc5cc930406e9ce0e9f721a8e21b1eadfebc, --session-override, --keep-artifacts], rss=46399488, heapTotal=34235136, heapUsed=17620112, loadavg=[1.60546875, 1.29833984375, 1.205078125], uptime=84958, trace=[], stack=undefined*
这是我要运行的脚本-
import static org.junit.Assume.assumeTrue;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class test {
WebDriver driver;
private static boolean isSupportedPlatform() {
Platform current = Platform.getCurrent();
return Platform.MAC.is(current) || Platform.WINDOWS.is(current);
}
@Before
synchronized public void createDriver() {
assumeTrue(isSupportedPlatform());
try {
//setup the web driver and launch the webview app.
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("app", "/Users/accesso/Library/Developer/Xcode/DerivedData/SafariLauncher-cquscfvgyludjdaolkpikgbmowez/Build/Products/Debug-iphoneos/SafariLauncher.app");
desiredCapabilities.setCapability("device", "iphone");
URL url = new URL("http://0.0.0.0:3001/wd/hub");
driver = new RemoteWebDriver(url, desiredCapabilities);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@After
public void quitDriver() {
driver.quit();
}
@Test
public void shouldBeAbleToPerformAGoogleSearch() {
driver.get("http://store.accesso.com/CF-KBF");
}
}