通过Firefox在空手道界面的文本框中输入值后出现错误



此问题仅在我通过firefox驱动程序调用脚本时,在文本框中输入值后出现错误并且测试失败

configure driver = {type:'geckodriver' , executable:'C:UsersdineshDownloadsgeckodriver-v0.31.0-win64geckodriver.exe'}
driver 'https://courses.ultimateqa.com/users/sign_in'
screenshot()
driver.maximize()
input("//*[@id='user[email]']","abc@gmail.com")

错误消息

* input("//*[@id='user[first_name]']", 'welcome')
js failed:
>>>>
01: input("//*[@id='user[first_name]']", 'welcome')
<<<<
org.graalvm.polyglot.PolyglotException: Expected to find an object with property ['message'] in path $['value'] but found 'null'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.
- com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:71)
- com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81)
- com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79)
- com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
- com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:99)
- com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:107)
- com.jayway.jsonpath.JsonPath.read(JsonPath.java:185)

请帮助我xpath是正确的,空手道是在文本框中写入值,但之后它是失败的

对于我来说,这段代码都可以使用chromedriver和geckodriver。当然,这些可执行文件必须在PATH环境变量中设置。我还添加了waitFor方法来等待web元素。

Feature: sample karate test script
for help, see: https://github.com/intuit/karate/wiki/IDE-Support
Background:
#* configure driver = { type: 'chromedriver', executable: 'chromedriver' }
* configure driver = { type: 'geckodriver', executable: 'geckodriver' }
#* def sleep = function(pause){ java.lang.Thread.sleep(pause) }
Scenario: test error
Given driver 'https://courses.ultimateqa.com/users/sign_in'
When waitFor("//*[@id='user[email]']").input('abc@gmail.com')
And waitFor("//*[@id='user[password]']").input('qwerty1234')
And waitFor("//input[@type='submit']").click()
* screenshot()
#* call sleep 3000

相关内容

最新更新