[TIP] Execute file upload from Katalon Docker to Selenium Grid

hello, i hope this will help to anybody seeking to upload file:
setup:

  1. create folder under katalon MUST NOT contains space e.g. files in my case
    image
  2. only think you need to change is driver when opening browser:
WebDriver wd = new RemoteWebDriver(new URL("https://selenim.grid.com/wd/hub"), capabilities)
	wd.setFileDetector(new LocalFileDetector());
	
	DriverFactory.changeWebDriver(wd)
  1. remember, you need to set path in way it can be “used” by remote driver - visible from outside Katalon docker (i’m using environmental variable for passing bamboo workdir to docker)
String path = (this.filePath == '') ? GlobalVariable.systemPath + "${File.separator}files${File.separator}500.xlsx" : this.filePath
  1. and send file using input field defined in objects:
	WebUI.waitForElementVisible(findTestObject('Object Repository/IRAMP-CC/CC UI/DataSubmissionTask Page/input_File'), 5)
	
	try {
		stepDescr = "File Upload"
		WebUI.sendKeys(findTestObject('Object Repository/IRAMP-CC/CC UI/DataSubmissionTask Page/input_File'), path)
		r.addStep(stepDescr, true)
	} catch (a) {
		r.addStep(stepDescr, false)
	}

dont mind addStep command it’s from my reporting solution

1 Like