Skip to main content

Failed to upload files for desktop application

The test fails to upload files in desktop environment provided by TestCloud.

A workaround is to use the LocalFileDetector with the code below so that the file can be uploaded automatically to the test machine.
import org.openqa.selenium.WebDriver
import org.openqa.selenium.remote.LocalFileDetector
import org.openqa.selenium.support.events.EventFiringWebDriver

import com.kms.katalon.core.configuration.RunConfiguration
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.selenium.driver.CRemoteWebDriver


EventFiringWebDriver driver = DriverFactory.getWebDriver()
WebDriver wrappedDriver = driver.getWrappedDriver()

if (wrappedDriver.class == CRemoteWebDriver) {
wrappedDriver.setFileDetector(new LocalFileDetector())
}