我的量角器配置文件如下所示:
var myHelper = require("./myHelper.js");
exports.config = {
seleniumAddress: 'http://localhost:4723/wd/hub', of appium url
chromeDriver: 'C:/appium/chromedriver',
specs: ['tests/file1.js'],
jasmineNodeOpts: {
defaultTimeoutInterval: 180000,
},
prefs: {
'profile.managed_default_content_settings.geolocation': 1,
'profile.default_content_settings.popups':0
},
multiCapabilities: [
{
browserName: 'chrome',
platformName: 'Android',
platformVersion: '7.0',
deviceName: 'ce10160a3538442705',
'newCommandTimeout' : 120,
'chromeOptions': {
'args': ["--use-fake-ui-for-media-stream", '--use-fake-device-for-media-stream', '--disable-web-security','--start-maximized','--full-reset']
},
}
],
onPrepare: function() {
global.browsers = {
a: (()=>{
browser.ignoreSynchronization = true;
return browser;
})(),
b: ()=> {
var br = browser.forkNewDriverInstance(false, false);
br.ignoreSynchronization = true;
return br;
},
myHelper: myHelper
};
},
};
&安培;使用以下命令运行appium:
appium -p 4723 -bp 4728 -U“ce10160a3538442705”--chromedriver-port 9516
当我运行量角器conf.js时,android设备被解锁但Chrome浏览器没有启动,它再次解锁自己。
日志:
[AndroidDriver] Using app unlock, this is going to be deprecated!
[AndroidDriver] Unlocking screen
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce10160a3538442705","shell","am","force-stop","io.appium.unlock"]
[debug] [ADB] Device API level: 24
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce10160a3538442705","shell","am","start","-W","-n","io.appium.unlock/.Unlock","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[debug] [ADB] Device API level: 24
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce10160a3538442705","shell","am","start","-W","-n","io.appium.unlock/.Unlock","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce10160a3538442705","shell","dumpsys","window"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce10160a3538442705","shell","dumpsys","window"]
[debug] [AndroidDriver] Shutting down Android driver
[debug] [ADB] Pressing the HOME button
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce10160a3538442705","shell","input","keyevent",3]
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [UiAutomator] Shutting down UiAutomator
[debug] [UiAutomator] Moving to state 'stopping'
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Test results for WatcherResultPrinter=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Time: 449.159
[debug] [AndroidBootstrap] [UIAUTO STDOUT] OK (1 test)
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: -1
[debug] [UiAutomator] UiAutomator shut down normally
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce10160a3538442705","shell","ps"]
[ADB] No uiautomator process found to kill, continuing...
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Android\sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","ce10160a3538442705","shell","am","force-stop","io.appium.unlock"]
[debug] [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[MJSONWP] Encountered internal error running command: Error: Screen did not unlock successfully, retrying
at Object.callee$1$0$ (../../lib/android-helpers.js:453:13)
at tryCatch (C:\Users\xxxx\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\xxxx\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\xxxx\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (C:\Users\xxxx\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:109:7)
[HTTP] <-- POST /wd/hub/session 500 463534 ms - 181
答案 0 :(得分:0)
我在这里想到了这个问题。该设备在30秒后设置为自动锁定,因此每当启动大约30秒时,它就会尝试再次解锁设备。 我想知道是否一起禁用自动锁是一个不错的选择。