Reputation: 59
I have recently implemented UI automation along with my API test automation (both in Karate). It is working now with minor issue - the browser is getting closed automatically after the script is executed completely. Is there a way in Karate to either close or retain the browser opened? Thank you!
Scenario: Get UI - Download
Given url 'https://test01/v1/doc/env/
And headers headers1
When method get
Then status 200
* def env = response.url
Given driver env
And click('{button}Proceed')
And click('{span}Start')
And click('{span}Required - GSA)
And click('{span}Required - GSB')
And click('{span}Required - GSC')
And click('{span}Required - GSD')
And click('{span}Required - GSE')
And click('{span}Required - GSF')
And click('{span}Required - GSG')
And click('{span}Required - GSH')
Upvotes: 1
Views: 815
Reputation: 58058
This is by design. You can try add a * karate.stop()
line at the end, but this is definitely not recommended for "normal" test scripts.
Also note that there is an option to step-through and debug tests: https://twitter.com/KarateDSL/status/1252817691963830272
EDIT: for those trying to "re-use" the browser across multiple flows, pleaser read this answer that explains why Karate is designed the way it is: https://stackoverflow.com/a/62325328/143475
Upvotes: 1
Reputation: 21
There is also:
* configure robot = { autoClose: false }
which worked for me on a desktop application.
Upvotes: 2