是否可以让Appium在远程计算机上运行,同时让设备连接到本地计算机,还可以从本地计算机运行测试?
目前,Appium继续检查adb用于运行Appium的设备(当然没有运行),并在超时后失败。我在本地运行Appium时没有任何问题。
以下是从连接设备的本地计算机运行的功能(IP:192.168.1.78):
@Before
public void setUp() throws Exception
{
final DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("appium-version", "1.2");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("deviceName", "SCH-I545");
capabilities.setCapability("appPackage", "<appPackage_goes_here>");
capabilities.setCapability("appActivity", "<appActivity_goes_here>");
driver = new AppiumDriver(new URL("http://192.168.2.109:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
以下是来自远程计算机的Appium Console日志(IP:192.168.2.109):
QA1@QA1s-Mac-mini:3.2: ~/appium :$node .
info: Welcome to Appium v1.2.0 (REV 83e64a139b928fb1f6c06e50370f9f0140ecaa30)
info: Appium REST http interface listener started on 0.0.0.0:4723
info: LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.4","platformName":"Android","deviceName":"SCH-I545","browserName":"","appActivity":"com.alldigital.android.cox.NewsActivity","appium-version":"1.2","appPackage":"com.cmgdigital.wsoctvhandset"}}
debug: The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : appium-version
debug: Didn't get app but did get Android package, will attempt to launch it on the device
debug: Creating new appium session b184a564-321d-4753-af63-9bd7fbf56b6e
info: Starting android appium
debug: Using fast reset? true
debug: Preparing device for session
debug: Not checking whether app is present since we are assuming it's already on the device
debug: Checking whether adb is present
debug: Using adb from /Users/QA1/android-sdk-macosx/sdk/platform-tools/adb
info: Retrieving device
debug: Trying to find a connected android device
debug: Getting connected devices...
debug: executing: "/Users/QA1/android-sdk-macosx/sdk/platform-tools/adb" devices
debug: 0 device(s) connected
debug: Could not find devices, restarting adb server...
debug: executing: "/Users/QA1/android-sdk-macosx/sdk/platform-tools/adb" kill-server
debug: Getting connected devices...
debug: executing: "/Users/QA1/android-sdk-macosx/sdk/platform-tools/adb" devices
debug: 0 device(s) connected
....... continues trying .......
debug: Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
debug: Cleaning up android objects
debug: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Could not find a connected Android device.
debug: Error: Could not find a connected Android device.
at ADB.getDevicesWithRetry (/Users/QA1/appium/node_modules/appium-adb/lib/adb.js:612:15)
at androidCommon.prepareActiveDevice (/Users/QA1/appium/lib/devices/android/android-common.js:354:12)
at null.<anonymous> (/Users/QA1/appium/lib/devices/android/android-common.js:294:26)
at /Users/QA1/appium/node_modules/async/lib/async.js:610:21
at /Users/QA1/appium/node_modules/async/lib/async.js:249:17
at iterate (/Users/QA1/appium/node_modules/async/lib/async.js:149:13)
at /Users/QA1/appium/node_modules/async/lib/async.js:160:25
at /Users/QA1/appium/node_modules/async/lib/async.js:251:21
at /Users/QA1/appium/node_modules/async/lib/async.js:615:34
at androidCommon.prepareEmulator (/Users/QA1/appium/lib/devices/android/android-common.js:344:5)
debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find a connected Android device.)","origValue":"Could not find a connected Android device."},"sessionId":null}
info: <-- POST /wd/hub/session 500 30473.764 ms - 206
答案 0 :(得分:0)
尝试使用:
driver = new RemoteWebDriver(new URL("http://192.168.2.109:4723/wd/hub"), capabilities);