gpt4 book ai didi

karate - 如何使用 Karate 框架中的功能文件调用Android模拟器

转载 作者:行者123 更新时间:2023-12-04 09:36:17 29 4
gpt4 key购买 nike

在空手道框架中执行功能文件时,将在模拟器中打开 Google URL。
但是由于以下原因,我得到的测试用例失败了:

17:49:10.459 [ForkJoinPool-1-worker-1] DEBUG c.i.k.driver.android_1593087505311 - poll attempt #20 
for port to be ready - localhost:58674
17:49:13.452 [ForkJoinPool-1-worker-1] DEBUG com.intuit.karate - request:
1 > POST http://localhost:58674/session
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Content-Length: 58
1 > Content-Type: application/json; charset=UTF-8
1 > Host: localhost:58674
1 > User-Agent: Apache-HttpClient/4.5.12 (Java/1.8.0_181)
{"capabilities":{"alwaysMatch":{"browserName":"android"}}}

“请给我解决方案”
前提条件:Appium Server 和模拟器正在运行。下面是特征文件。
特点:移动自动化
背景:
 * url 'http://localhost:4723/wd/hub'
* configure driver = { type: 'android' }
* def driverCaps = {"browserName": "chrome","newCommandTimeout":180, "platformVersion": "8.0",
"platformName": "Android","deviceName":"emulator-5554", "avd":"Nexus 6P API 26"}
Scenario: Perform additional operation

Given driver 'https://google.com'
And input("input[name=q]", 'karate dsl')
When submit().click("input[name=btnI]")
# this may fail depending on which part of the world you are in !
Then waitForUrl('https://github.com/intuit/karate')

最佳答案

您的 driverCaps未使用,因为您在 configure 之后定义了它,
使用下面的代码片段,我能够在 Android Emulator 中启动 chrome 浏览器。

Scenario: launch chrome in appium
* configure driver =
"""
{
type: 'android',
webDriverPath : "/wd/hub",
start: true,
httpConfig : { readTimeout: 120000 }
}
"""
* def desiredConfig =
"""
{
"newCommandTimeout" : 300,
"platformVersion" : "9.0",
"platformName" : "Android",
"connectHardwareKeyboard" : true,
"deviceName" : "emulator-5554",
"avd" : "Pixel2",
"automationName" : "UiAutomator2",
"browserName" : "Chrome"
}
"""
* driver { webDriverSession: { desiredCapabilities : "#(desiredConfig)"} }
* driver 'http://google.com'
* driver.input("//input[@name='q']", 'karate dsl')
注:

if you are facing any chrome driver issue please refer : chromedriver with Appium
currently only xpath locator are working so try with xpath locators

关于karate - 如何使用 Karate 框架中的功能文件调用Android模拟器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62575440/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com