In the below code i would like to use chromedriver in Karate
but do not want to give the hardcoded path C:Softwarechromedriver_win32chromedriver.exe
Reason :- Other team members might not have the chromedriver at the same path.
Feature: Check to open both browser
Scenario: open chrome with chromeDriver
* configure driver = {type:'chromedriver' , executable:'C:\Software\chromedriver_win32\chromedriver.exe'}
* driver 'https://www.google.com'
Any ways of handling this automatically? so that it’s downloaded via maven and Karate picks it up.
Instead of we downloading it(chromedriver/geckodriver) manually and putting in a relative folder(in project) or system folder
I have read the documentation which says it search in system PATH in windows or the one we give.
Anything which i might be missing please correct me.
0
Most teams use the PATH
default because it is easier to customize per machine.
But if you are expecting Karate to automatically download a driver via Maven or something like that, sorry that’s not supported nor is it ever planned.
Maybe you should look at WebDriverManager – just add it to your dependencies and use it, should be simple.
Also you should spend some time understanding Karate’s config system: https://github.com/intuit/karate#configuration
So assuming that you have the following karate-config.js
:
function fn() {
return { executable: 'C:/some/dir/chromedriver.exe' }
}
Now in any feature file the variable executable
will be set and available to use.
* configure driver = { type:'chromedriver', executable: '#(executable)' }
Take a look at this answer also: /a/60581024/143475
And you can study the project that Karate uses for CI
- it does some advanced tricks: https://github.com/intuit/karate/tree/master/karate-e2e-tests/src/test/java/driver
- is also an example of how with Docker, you don’t need to rely on a locally installed “webdriver” executable.
- and the same browser instance is re-used for multiple feature files, using
call
Also see: /a/68821168/143475
2