Javascript 量角器脚本无法在android设备上执行

Javascript 量角器脚本无法在android设备上执行,javascript,protractor,appium,Javascript,Protractor,Appium,我的量角器配置文件如下所示: 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: { defaultTimeo

我的量角器配置文件如下所示:

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-p 4723-bp 4728-U“ce10160a3538442705”--铬驱动端口9516

当我运行gragrator conf.js时,android设备会解锁,但chrome浏览器不会启动,它会再次自行解锁

日志:

[AndroidDriver]使用应用程序解锁,这将被弃用!
[AndroidDriver]解锁屏幕
[调试][ADB]正在连接设备。。。
[debug][ADB]已连接1个设备
[debug][ADB]运行带参数的'C:\Android\sdk\platform tools\ADB.exe:[“-P”,5037,“-s”,“ce10160a3538442705”,“shell”,“am”,“强制停止”,“io.appium.unlock”]
[调试][ADB]设备API级别:24
[调试][ADB]正在连接设备。。。
[debug][ADB]已连接1个设备
[debug][ADB]运行带参数的'C:\Android\sdk\platform tools\ADB.exe:[“-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”]
[调试][ADB]设备API级别:24
[调试][ADB]正在连接设备。。。
[debug][ADB]已连接1个设备
[debug][ADB]运行带参数的'C:\Android\sdk\platform tools\ADB.exe:[“-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”]
[调试][ADB]正在连接设备。。。
[debug][ADB]已连接1个设备
[debug][ADB]运行带参数的'C:\Android\sdk\platform tools\ADB.exe:[“-P”、5037、“-s”、“ce10160a3538442705”、“shell”、“dumpsys”、“window”]
[调试][ADB]正在连接设备。。。
[debug][ADB]已连接1个设备
[debug][ADB]运行带参数的'C:\Android\sdk\platform tools\ADB.exe:[“-P”、5037、“-s”、“ce10160a3538442705”、“shell”、“dumpsys”、“window”]
[debug][AndroidDriver]正在关闭Android驱动程序
[调试][ADB]按主页按钮
[调试][ADB]正在连接设备。。。
[debug][ADB]已连接1个设备
[debug][ADB]运行带参数的'C:\Android\sdk\platform tools\ADB.exe:[“-P”,5037,“-s”,“ce10160a353844705”,“shell”,“input”,“keyevent”,3]
[debug][AndroidBootstrap]正在向android发送命令:{“cmd”:“shutdown”}
[AndroidBootstrap][BOOTSTRAP LOG][debug]从客户端获取数据:{“cmd”:“shutdown”}
[AndroidBootstrap][BOOTSTRAP LOG][debug]获取了SHUTDOWN类型的命令
[debug][AndroidBootstrap]从引导程序接收到命令结果
[调试][UiAutomator]正在关闭UiAutomator
[调试][UiAutomator]正在移动到“正在停止”状态
[AndroidBootstrap][BOOTSTRAP LOG][debug]返回结果:{“状态”:0,“值”:“确定,正在关闭”}
[AndroidBootstrap][BOOTSTRAP LOG][debug]关闭的客户端连接
[debug][AndroidBootstrap][UIAUTO STDOUT]检测\u状态:numtests=1
[debug][AndroidBootstrap][UIAUTO STDOUT]检测\u状态:stream=。
[debug][AndroidBootstrap][UIAUTO STDOUT]检测\u状态:id=UiAutomatorTestRunner
[debug][AndroidBootstrap][UIAUTO STDOUT]插装\u状态:test=testRunServer
[debug][AndroidBootstrap][UIAUTO STDOUT]指令插入\u状态:class=io.appium.android.bootstrap.bootstrap
[debug][AndroidBootstrap][UIAUTO STDOUT]检测\u状态:当前=1
[debug][AndroidBootstrap][UIAUTO STDOUT]检测\u状态\u代码:0
[debug][AndroidBootstrap][UIAUTO STDOUT]检测\u状态:流=
WatcherResultPrinter的[debug][AndroidBootstrap][UIAUTO STDOUT]测试结果=。
[debug][AndroidBootstrap][UIAUTO STDOUT]时间:449.159
[debug][AndroidBootstrap][UIAUTO STDOUT]正常(1个测试)
[debug][AndroidBootstrap][UIAUTO STDOUT]检测\u状态\u代码:-1
[调试][UiAutomator]UiAutomator正常关闭
[调试][UiAutomator]正在移动到“已停止”状态
[debug][ADB]正在尝试终止所有uiautomator进程
[debug][ADB]使用uiautomator获取所有进程
[调试][ADB]正在连接设备。。。
[debug][ADB]已连接1个设备
[debug][ADB]运行带参数的'C:\Android\sdk\platform tools\ADB.exe:[“-P”,5037,“-s”,“ce10160a353844705”,“shell”,“ps”]
[ADB]未找到要终止的uiautomator进程,正在继续。。。
[调试][UiAutomator]正在移动到“已停止”状态
[调试][日志猫]正在停止日志猫捕获
[调试][ADB]正在连接设备。。。
[debug][ADB]已连接1个设备
[debug][ADB]运行带参数的'C:\Android\sdk\platform tools\ADB.exe:[“-P”,5037,“-s”,“ce10160a3538442705”,“shell”,“am”,“强制停止”,“io.appium.unlock”]
[debug][AndroidDriver]未清理生成的文件。如果需要,添加“clearSystemFiles”功能。
[MJSONWP]在运行命令时遇到内部错误:错误:屏幕未成功解锁,正在重试
在Object.callee$1$0$(../../lib/android helpers.js:453:13)
在tryCatch(C:\Users\xxxx\AppData\Roaming\npm\node\u modules\appium\node\u modules\babel runtime\registrator\runtime.js:67:40)
在GeneratorFunctionPrototype.invoke[作为_invoke](C:\Users\xxxx\AppData\Roaming\npm\node_modules\appium\node_modules\babel runtime\regenerator\runtime.js:315:22)
在GeneratorFunctionPrototype.prototype.(匿名函数)[作为下一个](C:\Users\xxxx\AppData\Roaming\npm\node\u modules\appium\node\u modules\babel runtime\regenerator\runtime.js:100:21)
在GeneratorFunctionPrototype.invoke(C:\Users\xxxx\AppData\Roaming\npm\node\u modules\appium\node\u modules\babel runtime\registrator\runtime.js:136:37)
在进程中。_tick回调(内部/process/next_tick.js:109:7)

[HTTP]我在这里找到了问题所在。设备在30秒后被设置为自动锁定,因为每当appium在30秒左右启动时,它都会再次尝试解锁设备。
我想知道禁用自动锁定是否是一个好的选择。

我在这里找到了问题所在。设备在30秒后被设置为自动锁定,因为每当appium在30秒左右启动时,它都会再次尝试解锁设备。 我想知道禁用自动锁是否是个好主意
[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