I'm using application properties file to set the capabilities of the chrome drive. Below is the code for that initially it worked fine but when I added "download.default_directory": "${dir.downloads}" it's not loading the driver as well.
dir.currentdirectory= ${expr:java.lang.System.getProperty("user.dir")}
dir.screenshots = ${dir.currentdirectory}\\resources\\screenshots
dir.downloads = ${dir.currentdirectory}\\resources\\downloads
chrome.additional.capabilities={"browserName":"chrome","goog:chromeOptions": {"args": ["start-maximized", "--disable-popup-blocking", "disable-infobars", "--disable-extensions"], "extensions": [], "prefs": {"download.directory_upgrade": "true", "download.default_directory": "${dir.downloads}", "download.prompt_for_download": "false", "safebrowsing.enabled": "true"}}}
I tried access that value using below code to check the string and its showing correct value. Not sure why its not loading.
String myString = getBundle().getString("chrome.additional.capabilities");
System.out.println("=============="+myString);
Following works fine for me:
If you want to use
\\add addition\for each\because\is escape char in properties file. For instance fora\byou need to seta\\band fora\\byou need to seta\\\\b. Considering this you can also try as below:As a side not you can use any system properties directly with configuration manager (so as parameter) and system properties has highest prority. So you don't need to use
exprfor to access system property. You can directly refer it as parameter. For example: