Skip to content

Commit

Permalink
🐛 Set ChromeServiceModule files as executable before execution (#1789)
Browse files Browse the repository at this point in the history
  • Loading branch information
guiyanakuang authored Sep 4, 2024
1 parent 0ab268c commit 868a858
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,23 @@ class DesktopChromeService(
val installPath = moduleLoaderConfig.installPath
moduleLoaderConfig.getModuleItem(CHROME_DRIVER_MODULE_ITEM_NAME)?.let { chromeDriverModule ->
moduleLoaderConfig.getModuleItem(CHROME_HEADLESS_SHELL_MODULE_ITEM_NAME)?.let { chromeHeadlessShellModule ->
val chromeDriverFile = chromeDriverModule.getModuleFilePath(installPath).toFile()
val chromeHeadlessShellFile = chromeHeadlessShellModule.getModuleFilePath(installPath).toFile()

if (!chromeDriverFile.canExecute()) {
chromeDriverFile.setExecutable(true)
}

if (!chromeHeadlessShellFile.canExecute()) {
chromeHeadlessShellFile.setExecutable(true)
}

chromeDriverService = ChromeDriverService.createDefaultService()
System.setProperty(
"webdriver.chrome.driver",
chromeDriverModule.getModuleFilePath(installPath).toString(),
chromeDriverFile.absolutePath,
)
options.setBinary(chromeHeadlessShellModule.getModuleFilePath(installPath).toFile())
options.setBinary(chromeHeadlessShellFile)
chromeDriver = ChromeDriver(chromeDriverService, options)
return true
}
Expand Down

0 comments on commit 868a858

Please sign in to comment.