I'm new to Katalon, groovy and has very basic understanding of Java. I keep on getting this error after I update the drivers.
Q: Why am I getting this error? How can I fix this?
Error:
Reason:
groovy.lang.MissingPropertyException: No such property: chromeDriverPath for class: com.kms.katalon.core.webui.driver.DriverFactory
at utils.Browser.setPreferences(Browser.groovy:107)
at utils.Browser.openBrowser(Browser.groovy:39)
Code:
public class Browser {
private static CommonObjects.NavigationBar NAVIGATION_BAR_OBJECTS = new CommonObjects.NavigationBar()
public static void openBrowser(String url) {
new Browser().setPreferences()
deleteAllCookies()
goTo(url)
maximizeWindow()
delay(3)
String pageTitle = getWindowTitle().trim()
logInfo("Navigated to [" + pageTitle + "].")
delay(2)
}
public static void setPreferences() {
String downloadPath = ReviewConstants.FolderDirectories.DOWNLOAD
KeywordUtil.logInfo("The download path is [" + downloadPath + "].")
// The necessary preferences to set.
Map<Object, String> prefs = new HashMap<Object, String>()
prefs.put("download.default_dictionary", downloadPath)
prefs.put("download.direcory_update", true)
prefs.put("download.prompt_for_download", false)
prefs.put("browser.download.dir", downloadPath)
prefs.put("download.default_directory", downloadPath)
prefs.put("profile.content_settings.exceptions.automatic_downloads.*.setting", 1) // Allow multiple downloads without prompt
KeywordUtil.logInfo("The browser is [" + DriverFactory.getExecutedBrowser().getName() + "].")
switch (DriverFactory.getExecutedBrowser().getName()) {
case "CHROME_DRIVER" :
System.setProperty('webdriver.chrome.driver', DriverFactory.chromeDriverPath)
ChromeOptions chromeOptions = new ChromeOptions()
chromeOptions.setExperimentalOption("prefs", prefs)
DriverFactory.changeWebDriver(new ChromeDriver(chromeOptions))
break
default:
throw new Exception("Failed to set the preferences. Browser may be incompatible.")
}
}
}
Update the webdriver.