Karate 在执行脚本时,它将在emulator中启动URL,而行的其余部分不会在空手道框架中执行

Karate 在执行脚本时,它将在emulator中启动URL,而行的其余部分不会在空手道框架中执行,karate,Karate,当我执行脚本时,它会在emulator中启动URL“www.google.com”,而其余的代码都不会执行。 “请向我推荐解决方案”这样写元素吗? 环境详情: JDK1.8 Appium v1.17 节点JSV12.18 安德里奥德斯图伊多v4 功能文件: 特点:测试手机 场景:在appium中推出chrome * configure driver = """ { type: 'android', webDriverPath : "/

当我执行脚本时,它会在emulator中启动URL“www.google.com”,而其余的代码都不会执行。 “请向我推荐解决方案”这样写元素吗? 环境详情: JDK1.8 Appium v1.17 节点JSV12.18 安德里奥德斯图伊多v4

功能文件: 特点:测试手机

场景:在appium中推出chrome

* configure driver = 
"""
{ 
    type: 'android', 
    webDriverPath : "/wd/hub", 
    start: true, 
    httpConfig : { readTimeout: 120000 }
}
"""
* def desiredConfig = 
"""
{
   "newCommandTimeout" : 300,
   "platformVersion" : "10.0",
   "platformName" : "Android",
   "connectHardwareKeyboard" : true,
   "deviceName" : "emulator-5554",
   "avd" : "Pixel_2_API_29",
   "automationName" : "UiAutomator2",
   "browserName" : "Chrome" ,
   "chromedriverExecutable" : "C:/Users/abc/Downloads/chromedriver_win32_2/chromedriver.exe"
  }
"""
    * driver { webDriverSession: { desiredCapabilities : "#(desiredConfig)"} }
    * driver 'http://google.com'
      And delay(4000)
    * driver click("//a[text()='Images']")
    # driver.input("//input[@name='q']", 'karate dsl')
登录控制台:

10:31:16.654 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [HTTP] --> POST /wd/hub
/session/3b12fd81-db3b-421e-8218-b94c1ed331b5/element
10:31:16.695 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [HTTP] {"using":"xpath","value":"//a[text()
='Images']"}
10:31:16.698 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [MJSONWP (3b12fd81)] Calling AppiumDrive
r.findElement() with args: ["xpath","//a[text()='Images']","3b12fd81-db3b-421e-8218-b94c1ed331b5"]
10:31:16.699 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [BaseDriver] Valid locator strategies fo
r this request: xpath, id, class name, accessibility id, -android uiautomator
10:31:16.702 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [BaseDriver] Waiting up to 0 ms for cond
ition
10:31:16.703 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [WD Proxy] Matched '/element' to command
 name 'findElement'
10:31:16.706 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [WD Proxy] Proxying [POST /element] to [
POST http://127.0.0.1:8203/wd/hub/session/600582cc-a05b-422e-b886-7daeff02de45/element] with body: {"strategy":"xpath","selector":"//a[text()='Images']","context":"","multiple":false}
10:31:17.466 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [WD Proxy] Got response with status 404: {"sessi
onId":"600582cc-a05b-422e-b886-7daeff02de45","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.findElement(FindElement.java:102)\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:72)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:38)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:242)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:51)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerCon...
10:31:17.467 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [W3C] Matched W3C error code 'no such el
ement' to NoSuchElementError
10:31:17.474 [ForkJoinPool-1-worker-1] DEBUG com.intuit.karate - response time in milliseconds: 823.75
5 < 500
5 < Connection: keep-alive
5 < Content-Length: 164
5 < Content-Type: application/json; charset=utf-8
5 < Date: Wed, 01 Jul 2020 05:01:17 GMT
5 < ETag: W/"a4-/qNMwkKiq6QWZf9aZdImFcg10wM"
5 < Vary: X-HTTP-Method-Override
5 < X-Powered-By: Express
{"status":7,"value":{"message":"An element could not be located on the page using the given search parameters."},"sessionId":"3b12fd81-db3b-421e-8218-b94c1ed331b5"}

10:31:17.478 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [MJSONWP (3b12fd81)] Encountered interna
l error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.
10:31:17.484 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [MJSONWP (3b12fd81)]     at AndroidUiaut
omator2Driver.findElOrEls (C:\Users\M1058955\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-driver\lib\commands\find.js:75:11)
10:31:17.484 [ForkJoinPool-1-worker-1] WARN  com.intuit.karate - http response code: 500, response: {"sessionId":"3b12fd81-db3b-421e-8218-b94c1ed331b5","value":{"message":"An element could not be located on the page using the given search parameters."},"status":7}, request: [method: POST, responseTime: 823.7536, body: {"using":"xpath","value":"//a[text()='Images']"}]
10:31:17.484 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [HTTP] <-- POST /wd/hub/session/3b12fd81-db
3b-421e-8218-b94c1ed331b5/element 500 819 ms - 164
10:31:17.484 [ForkJoinPool-1-worker-1] WARN  c.i.k.driver.android_1593579654225 - locator failed, will retry once: {"sessionId":"3b12fd81-db3b-421e-8218-b94c1ed331b5","value":{"message":"An element could not be located on the page using the given search parameters."},"status":7}
10:31:17.485 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [HTTP] 
10:31:20.490 [ForkJoinPool-1-worker-1] DEBUG com.intuit.karate - request:
6 > POST http://localhost:50636/wd/hub/session/3b12fd81-db3b-421e-8218-b94c1ed331b5/element
6 > Accept-Encoding: gzip,deflate
6 > Connection: Keep-Alive
6 > Content-Length: 48
6 > Content-Type: application/json; charset=UTF-8
6 > Host: localhost:50636
6 > User-Agent: Apache-HttpClient/4.5.12 (Java/1.8.0_181)
{"using":"xpath","value":"//a[text()='Images']"}

10:31:20.531 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [HTTP] --> POST /wd/hub
/session/3b12fd81-db3b-421e-8218-b94c1ed331b5/element
10:31:20.532 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [HTTP] {"using":"xpath","value":"//a[text()
='Images']"}
10:31:20.533 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [MJSONWP (3b12fd81)] Calling AppiumDrive
r.findElement() with args: ["xpath","//a[text()='Images']","3b12fd81-db3b-421e-8218-b94c1ed331b5"]
10:31:20.534 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [BaseDriver] Valid locator strategies fo
r this request: xpath, id, class name, accessibility id, -android uiautomator
10:31:20.535 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [BaseDriver] Waiting up to 0 ms for cond
ition
10:31:20.536 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [WD Proxy] Matched '/element' to command
 name 'findElement'
10:31:20.536 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [WD Proxy] Proxying [POST /element] to [
POST http://127.0.0.1:8203/wd/hub/session/600582cc-a05b-422e-b886-7daeff02de45/element] with body: {"strategy":"xpath","selector":"//a[text()='Images']","context":"","multiple":false}
10:31:21.026 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [WD Proxy] Got response with status 404: {"sessi
onId":"600582cc-a05b-422e-b886-7daeff02de45","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.findElement(FindElement.java:102)\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:72)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:38)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:252)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:242)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:51)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerCon...
10:31:21.027 [android_1593579654225] DEBUG c.i.k.driver.android_1593579654225 - [debug] [W3C] Matched W3C error code 'no such el
ement' to NoSuchElementError
10:31:21.028 [ForkJoinPool-1-worker-1] DEBUG com.intuit.karate - response time in milliseconds: 498.60
6 < 500
10:31:16.654[android_1593579654225]调试c.i.k.driver.android_1593579654225-[HTTP]-->POST/wd/hub
/会话/3b12fd81-db3b-421e-8218-b94c1ed331b5/元素
10:31:16.695[android_1593579654225]调试c.i.k.driver.android_1593579654225-[HTTP]{“使用”:“xpath”,“value”:”//a[text()
='Images']“}
10:31:16.698[android_1593579654225]调试c.i.k.driver.android_1593579654225-[DEBUG][MJSONWP(3b12fd81)]调用AppiumDrive
r、 带参数的findElement()[“xpath”、“//a[text()='Images']、“3b12fd81-db3b-421e-8218-b94c1ed331b5”]
10:31:16.699[android_1593579654225]调试c.i.k.driver.android_1593579654225-[DEBUG][BaseDriver]有效的定位器策略
r此请求:xpath、id、类名、可访问性id、-android uiautomator
10:31:16.702[android_1593579654225]调试c.i.k.driver.android_1593579654225-[DEBUG][BaseDriver]等待0毫秒,等待cond
煽动
10:31:16.703[android_1593579654225]调试c.i.k.driver.android_1593579654225-[DEBUG][WD Proxy]将“/element”与命令匹配
名称“findElement”
10:31:16.706[android_1593579654225]调试c.i.k.driver.android_1593579654225-[DEBUG][WD Proxy]代理[POST/element]到[
邮递http://127.0.0.1:8203/wd/hub/session/600582cc-a05b-422e-b886-7daeff02de45/element],正文:{“策略”:“xpath”,“选择器”:”//a[text()='Images'],“上下文”:“多个”:false}
10:31:17.466[android_1593579654225]调试c.i.k.driver.android_1593579654225-[WD Proxy]获得状态为404:{“session”的响应
onId:“600582cc-a05b-422e-b886-7daeff02de45”,“值”:{“错误”:“没有这样的元素”,“消息”:“使用给定的搜索参数无法在页面上找到元素”,“stacktrace”:“io.appium.uiautomator2.common.exceptions.ElementNotFoundException:使用给定的搜索参数在页上找不到元素\n\t io.appium.uiautomator2.handler.FindElement.FindElement.FindElement(FindElement.java:102)\n\t io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:72)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:38)\n\tat io.appium.uiautomator2.server.AppiumServlet.HandlerRequest(AppiumServlet.java:252)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:242)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:51)\n\t io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\t io.netty.channel.AbstractChannelHandlerCon。。。
10:31:17.467[android_1593579654225]调试c.i.k.driver.android_1593579654225-[DEBUG][W3C]匹配W3C错误代码“无此类错误”
到NoSuchElementError
10:31:17.474[ForkJoinPool-1-worker-1]DEBUG com.intuit.karate-响应时间(毫秒):823.75
5 < 500
5<连接:保持活动
5<内容长度:164
5<内容类型:application/json;字符集=utf-8
5<日期:星期三,2020年7月1日05:01:17 GMT
5接受编码:gzip,deflate
6>连接:保持活动状态
6>内容长度:48
6>内容类型:application/json;字符集=UTF-8
6>主机:本地主机:50636
6>用户代理:Apache HttpClient/4.5.12(Java/1.8.0_181)
{“使用”:“xpath”,“值”:“//a[text()='Images']”
10:31:20.531[android_1593579654225]调试c.i.k.driver.android_1593579654225-[HTTP]-->POST/wd/hub
/会话/3b12fd81-db3b-421e-8218-b94c1ed331b5/元素
10:31:20.532[android_1593579654225]调试c.i.k.driver.android_1593579654225-[HTTP]{“使用”:“xpath”,“值”:”//a[text()
='Images']“}
10:31:20.533[android_1593579654225]调试c.i.k.driver.android_1593579654225-[DEBUG][MJSONWP(3b12fd81)]调用AppiumDrive
r、 带参数的findElement()[“xpath”、“//a[text()='Images']、“3b12fd81-db3b-421e-8218-b94c1ed331b5”]
10:31:20.534[android_1593579654225]调试c.i.k.driver.android_1593579654225-[DEBUG][BaseDriver]有效的定位器策略
r此请求:xpath、id、类名、可访问性id、-android uiautomator
10:31:20.535[android_1593579654225]调试c.i.k.driver.android_1593579654225-[DEBUG][BaseDriver]等待0毫秒,等待cond
煽动
10:31:20.536[android_1593579654225]调试c.i.k.driver.android_1593579654225-[DEBUG][WD Proxy]将“/element”与逗号匹配
Given driver 'https://www.google.com'
Then waitForUrl('https://www.google.com')
And click("//a[text()='Images']")
And input("//input[@name='q']", 'karate dsl')