【问题标题】:Karate UI: driver.location method induces Error: path: $, actual: null空手道 UI:driver.location 方法引发错误:路径:$,实际:null
【发布时间】:2019-12-06 08:59:31
【问题描述】:

我正在尝试使用方法 driver.location,但结果出现错误:路径:$,实际:null

我的代码: 功能:浏览器自动化 背景: * 配置驱动 = { type: 'chromedriver', showDriverLog: true }

场景:尝试登录github 然后谷歌搜索

给定驱动程序“https://github.com/login” 然后匹配 driver.location == 'https://github.com/login'

错误:路径:$,实际:null,

如何处理这种行为?

【问题讨论】:

  • 请正确格式化您的问题:)

标签: karate


【解决方案1】:

首先确保您使用的是最新的 RC 版本 0.9.5.RC4,我们确实将 location 重命名为 urlhttps://github.com/intuit/karate/tree/develop/karate-core#driverurl

或者使用waitForUrl()哪个更好:https://github.com/intuit/karate/tree/develop/karate-core#waitforurl

Given driver 'https://github.com/login'
Then waitForUrl('https://github.com/login')

请注意,这里有一个 ZIP 版本(包括演示 web-browser-test),使用起来更简单:https://github.com/intuit/karate/wiki/ZIP-Release

【讨论】:

  • 答案很快!谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多