Appium IOS 真机测试 iphone
2015-05-27 09:05
190 查看
使用APPIUM + java 操作真机报下面的错误!
错误详情:
错误:
配置
代码
APPium 报错打印日志
解决方案:
1,启动Appium 加上设备UDID 和BUID
2,启动真机代码内的配置内容:
3,这样就可以启动我们真机上的app了
错误详情:
错误:
配置
代码
package ios; import static org.junit.Assert.*; import io.appium.java_client.remote.MobileCapabilityType; import java.io.File; import java.net.URL; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; public class CASE { WebDriver driver; @Before public void setUp() throws Exception { // set up appium // File appDir = new File(System.getProperty("github/local/AppiumTest/sample-code/apps/TestApp/Products"); DesiredCapabilities capabilities = new DesiredCapabilities(); // capabilities.setCapability("device", "iPhone Simulator"); //capabilities.setCapability(CapabilityType.BROWSER_NAME,"iOS"); capabilities.setCapability(CapabilityType.VERSION,"7.1"); capabilities.setCapability(CapabilityType.PLATFORM,"Mac"); capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); capabilities.setCapability("deviceName", "pohoto"); capabilities.setCapability("platformName", "ios"); capabilities.setCapability(MobileCapabilityType.APP,"com.yiguo.YiGuoApp"); driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"),capabilities); } @Test public void example() throws Exception { // find an element by tag name WebElement button = driver.findElement(By.tagName("button")); button.click(); // get the value of the element WebElement texts = driver.findElement(By.tagName("staticText")); assertEquals(texts.getText(), "some expected value"); } }
APPium 报错打印日志
Last login: Thu Jan 29 15:20:12 on ttys000 liyudeMac-mini:~ admin$ appium -U 728CD07EF9A84DFEB0C04CC20D02A68D3162CD8E --app com.yiguo.YiGuoApp info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe) info: Appium REST http interface listener started on 0.0.0.0:4723 info: [debug] Non-default server args: {"app":"com.yiguo.YiGuoApp","udid":"728CD07EF9A84DFEB0C04CC20D02A68D3162CD8E"} info: Console LogLevel: debug info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"io.appium.TestApp","platformVersion":"7.1","browserName":"","platformName":"iOS","deviceName":"iPhone Simulator"}} info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5) info: [debug] App is an iOS bundle, will attempt to run as pre-existing info: [debug] Creating new appium session 9e25c17f-5e62-4cb6-9835-90c4f196fc4e info: [debug] Removing any remaining instruments sockets info: [debug] Cleaned up instruments socket /tmp/instruments_sock info: [debug] Setting Xcode folder info: [debug] Setting Xcode version info: [debug] Setting iOS SDK Version info: [debug] Getting sdk version from xcrun with a timeout info: [debug] iOS SDK Version set to 8.1 info: [debug] Not checking whether simulator is available since we're on a real device info: [debug] Detecting automation tracetemplate info: [debug] Not auto-detecting udid, running on sim info: [debug] Could not parse plist file (as binary) at /usr/local/lib/node_modules/appium/io.appium.TestApp/en.lproj/Localizable.strings info: Will try to parse the plist file as XML `parseFileSync()` is deprecated. Use `parseStringSync()` instead. info: [debug] Could not parse plist file (as XML) at /usr/local/lib/node_modules/appium/io.appium.TestApp/en.lproj/Localizable.strings warn: Could not parse app Localizable.strings; assuming it doesn't exist info: [debug] Creating instruments info: On some xcode 6 platforms, instruments-without-delay does not work. If you experience this, you will need to re-run appium with the --native-instruments-lib flag info: [debug] Preparing uiauto bootstrap info: [debug] Dynamic bootstrap dir: /Users/admin/Library/Application Support/appium/bootstrap info: [debug] Dynamic env: {"nodePath":"/usr/local/Cellar/node/0.10.35_2/bin/node","commandProxyClientPath":"/usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js","instrumentsSock":"/tmp/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"sendKeyStrategy":"grouped"} info: [debug] Dynamic bootstrap code: // This file is automatically generated. D...ot manually modify! info: [debug] Dynamic bootstrap path: /Users/admin/Library/Application Support/appium/bootstrap/bootstrap-c28cdf2cec4fb293.js info: [debug] Reusing dynamic bootstrap: /Users/admin/Library/Application Support/appium/bootstrap/bootstrap-c28cdf2cec4fb293.js info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"6.1","iOSSDKVersion":"8.1","deviceName":"iPhone Simulator","platformVersion":"7.1"} info: [debug] fixDevice is on info: [debug] Fixing device. Changed from: "iPhone Simulator (7.1 Simulator)" to: "iPhone 5s (7.1 Simulator)" info: [debug] Final device string is: 'iPhone 5s (7.1 Simulator)' info: [debug] Not setting device type since we're on a real device info: [debug] Checking whether we need to set app preferences info: [debug] Not setting iOS and app preferences since we're on a real device info: [debug] Running ios sim reset flow info: [debug] Killing the simulator process info: [debug] Killall iOS Simulator info: [debug] Killing any other simulator daemons info: [debug] On a real device; cannot clean device state info: [debug] Not setting locale because we're using a real device info: [debug] No iOS / app preferences to set info: [debug] Starting iOS device log capture via deviceconsole error: Log capture did not start in a reasonable amount of time info: [debug] Cleaning up appium session error: Failed to start an Appium session, err was: Error: Log capture did not start in a reasonable amount of time info: [debug] Error: Log capture did not start in a reasonable amount of time at null._onTimeout (/usr/local/lib/node_modules/appium/lib/devices/ios/ios-log.js:137:10) at Timer.listOnTimeout [as ontimeout] (timers.js:112:15) info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Log capture did not start in a reasonable amount of time)","origValue":"Log capture did not start in a reasonable amount of time"},"sessionId":null} info: <-- POST /wd/hub/session 500 10228.916 ms - 234 info: [debug] Not pre-launching simulator info: [debug] Creating iDevice object with udid 728CD07EF9A84DFEB0C04CC20D02A68D3162CD8E info: [debug] Couldn't find ideviceinstaller, trying built-in at /usr/local/lib/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller info: [debug] Checking app install status using: /usr/local/lib/node_modules/appium/build/fruitstrap/fruitstrap isInstalled --id 728CD07EF9A84DFEB0C04CC20D02A68D3162CD8E --bundle io.appium.TestApp
解决方案:
1,启动Appium 加上设备UDID 和BUID
2,启动真机代码内的配置内容:
public void setUp() throws Exception { // set up appium DesiredCapabilities capabilities = new DesiredCapabilities(); //capabilities.setCapability(CapabilityType.BROWSER_NAME, "ios"); capabilities.setCapability(CapabilityType.VERSION, "7.1"); capabilities.setCapability(CapabilityType.PLATFORM, "Mac"); //capabilities.setCapability("device", "iPhone Simulator"); //capabilities.setCapability("app", "safai"); capabilities.setCapability("deviceName", "pohoto");//pohoto capabilities.setCapability("platformName", "ios"); driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
3,这样就可以启动我们真机上的app了
相关文章推荐
- iphone 程序真机测试 -Xcode
- iPhone 真机测试(调试)教程-伪造证书-免iPhone developer付款
- xcode4.6.1 iphone 5 ios 6 免证真机测试
- cocos2d-x iphone真机测试出现闪屏现象
- (zz)How to sideload apps on your iPhone using Xcode 7(无需99刀也能在真机上测试App)
- xcode4.6.1 iphone 5 ios 6 免证真机测试
- [iOS]iPhone进行真机测试(基础版)
- iOS: iphone在真机测试以及apns的设置
- iphone 4 程序开发:真机测试 (免费无99刀)
- 真机测试中设备的UDID加满了如何给新设备打包(iPhone上限100台,以xcode7.3为例)
- iphone开发--ios 真机测试
- 解决Xcode7.0在iPhone 9.2 系统真机测试时出现could not find developer disk image问题
- iPhone真机测试过程详解(Xcode5最新)
- iphone固件升级到3.1.3 ,HelloWorld成功安装到iPhone真机测试
- 不付费($99)真机测试iPad/iPhone/iTouch应用[亲测]
- iphone开发--真机测试
- iphone开发流程:注册、开发、真机测试、发布以及上线。
- iphone 4 程序开发:真机测试 (免费无99刀)
- ionic应用在mac上使用Xcode7.2(7C68)进行iphone真机测试
- appium iOS 真机测试实例