Karate driver.url does not capture what is in the window location

Viewed 80

When I am using karate to match driver url, if the url is unreachable, the driver.url doesn't give the correct url that is on chrome browser

And print driver.url
Then match driver.url == '#regex http://localhost:3000/?code=*.'

The print driver line gives the following as the url chrome-error://chromewebdata/ How can I use windows location in karate as the workaround.

Using Karate version 0.9.6

1 Answers

Use JS to get the actual value of window.location.href from the browser:

* match script('window.location.href') contains 'localhost:3000/?code='
Related