0
使用最新的appium版本與我完全配置的iOS 7設備進行通信。使用Appium在實際設備上自動化移動Safari並遇到未捕獲的異常
我可以讓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");
}
}
此鏈接可能有一些幫助.... https://groups.google.com/forum/#!topic/appium-discuss/D8N7bxtcZyw –
您是否檢查uiautomation是否在設置中? –