问题
I am trying to use method driver.location, but as a result I got the error : path: $, actual: null
My code: Feature: browser automation Background: * configure driver = { type: 'chromedriver', showDriverLog: true }
Scenario: try to login to github and then do a google search
Given driver 'https://github.com/login' Then match driver.location == 'https://github.com/login'
EROR: path: $, actual: null,
How to deal with this behavior?
回答1:
First make sure you are on the latest RC version 0.9.5.RC4, and we did rename location
to url
: https://github.com/intuit/karate/tree/develop/karate-core#driverurl
Or use waitForUrl()
which is better: https://github.com/intuit/karate/tree/develop/karate-core#waitforurl
Given driver 'https://github.com/login'
Then waitForUrl('https://github.com/login')
Note that there is a ZIP release (including a demo web-browser-test) which can be simpler to use here: https://github.com/intuit/karate/wiki/ZIP-Release
来源:https://stackoverflow.com/questions/59209869/karate-ui-driver-location-method-induces-error-path-actual-null