File upload - TC run successsful but my web app throw an error "Name has an issue: Please select file

Here is my environment summary.

  1. web app was built under low code platform (MENDIX),
  2. Katalon Studio for Windows, build 8.6.6-65709cbd
  3. Smart Wait was disabled

My requirement is to upload Excel file (xlsx) onto application per requirement. I ran my code, it was passed with no error in Katalon Studio but my web app throw error message - Name has an issue: Please select file. (images shown below)

below image: I ran my TC again and success with no error, but file was not uploaded.

below image: my web app thrown error message.

And file was not uploaded as expected but my Katalon Studio shown green mark (OK). I double-checked my uploaded filename again and again, nothing different.

Below was my script — sensitive information will mark with XXX

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys

WebUI.callTestCase(findTestCase(‘PHS Log In’), [:], FailureHandling.STOP_ON_FAILURE)

WebUI.maximizeWindow()

WebUI.delay(2)

WebUI.click(findTestObject(‘Object Repository/PHS/Page_XXXXX XXXXX -/hamburger_menu’))

WebUI.delay(2)

WebUI.click(findTestObject(‘Object Repository/PHS/Page_XXXXX XXXXX -/a_Import health book(side-menu)’))

WebUI.delay(2)

WebUI.click(findTestObject(‘PHS/Page_XXXXX XXXXX - Import health book/h2_Job information’), FailureHandling.STOP_ON_FAILURE)

WebUI.delay(2)

WebUI.click(findTestObject(‘Object Repository/PHS/Page_XXXXX XXXXX - Import health book/button_Upload’))

WebUI.uploadFile(findTestObject(‘PHS/Page_XXXXX XXXXX - Import health book/button_Browse’), ‘C:\\fakepath\\29Sept23\\1.JobInformation.xlsx’)

WebUI.delay(5)

WebUI.click(findTestObject(‘Object Repository/PHS/Page_XXXXX XXXXX - Import health book/button_Import’))

WebUI.delay(2)

WebUI.click(findTestObject(‘Object Repository/PHS/Page_XXXXX XXXXX - Import health book/button_OK’))

Do I put something incorrect here, please advice. Thank you

1 Like

Hi,

Can you please try Failure handling and verifyElementPresent when you upload file? If possible, can you try upload by Drag and Drop?

Hi @Elly_Tran , thanks for your reply. I did test with verifyElementPresent / verifyElementVisible but still not working.

By the way, my application is not support Drag and Drop for file uploading. I did testing this once.

I found that I’m incorrect choosing locator, then application return that error message " [Name has an issue: Please select file".

Thanks a lot for your help @Elly_Tran

1 Like