通过Firefox进入空手道UI中的文本框中输入值后获得错误

发布于 2025-02-05 20:36:13 字数 1481 浏览 1 评论 0原文

此问题只有当我通过Firefox驱动程序调用脚本时,在输入文本框中的值后,出现错误和测试是错误

configure driver = {type:'geckodriver' , executable:'C:\Users\dinesh\Downloads\geckodriver-v0.31.0-win64\geckodriver.exe'}
driver 'https://courses.ultimateqa.com/users/sign_in'
screenshot()
driver.maximize()
input("//*[@id='user[email]']","[email protected]")

消息,

* 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是正确的,空手道是在文本框中写入值,但是之后是失败

This issue is only when I invoke the scripts via firefox driver, after entering value in a text box getting an error and test is failing

configure driver = {type:'geckodriver' , executable:'C:\Users\dinesh\Downloads\geckodriver-v0.31.0-win64\geckodriver.exe'}
driver 'https://courses.ultimateqa.com/users/sign_in'
screenshot()
driver.maximize()
input("//*[@id='user[email]']","[email protected]")

Error message

* 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)

Please help me the xpath is right, karate is writing the value in text box but after that it is failing

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉月流沐 2025-02-12 20:36:13

对我来说,这种代码都可以使用Chromedriver和Geckodriver。当然,这些可执行文件必须在路径环境变量中设置。
我还添加了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('[email protected]')
    And waitFor("//*[@id='user[password]']").input('qwerty1234')
    And waitFor("//input[@type='submit']").click()
    * screenshot()
    #* call sleep 3000

For me this code works, both with chromedriver and geckodriver. Of course these executables must be set in the PATH environment variable.
I added also the waitFor method to wait for the web element.

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('[email protected]')
    And waitFor("//*[@id='user[password]']").input('qwerty1234')
    And waitFor("//input[@type='submit']").click()
    * screenshot()
    #* call sleep 3000
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文