How to mix in the same test case the web and MS Windows environments?

Hello everyone,
In a test scenario of my web application, a click button opens the common detailed MS Windows native window which allows to choose a file by drag & drop, or to enter it with or without its path, then validate the choice by a click button and close the window, so that the scenario continues.

Katalon Studio does not record the actions on the MS Windows dialog box and the manipulated objects and the modification of the script with the keyword proposed in the online documentation “WebUI.uploadFile(findTestObject(‘my button object’), ‘my path file name’)” does not work.

How to save the objects of the dialog box?
What keywords should be used in the script to get around this problem and switch between web environment and Windows environment?

Actions:

  • Click on web button
  • The MS Windows dialog box is open
  • Tape the file name to load
  • Click the open windows button
  • The MS Windows dialog box is closed

Thanks in advance for your advice

I don’t believe it is possible to use the spy recording tools across Web and Windows environments – you will have to code the test by hand.

When you start a new test case, the relevant APIs for both WebUI and Windows should already be imported.

1 Like

thank you for answering Russ :slight_smile:
Unfortunely it is already the case.

My difficulty is how to identify properties of this Windows dialog, to create by hand a new window object in KS’s objects repository (what value for this dialog class, name, id etc.) to use keywords windows after.

@vu.tran Who is the Windows testing guru?

1 Like

Thank you @Russ_Thomas for sharing this with me. I will check internally and get back to @thierry.gonzalvez soon. Thank you guys!

Thank you all,
To clarify, I provide the following screenshots and the test procedure

  1. I navigate until this modal popup very easily
  2. I click the « ajouter des fichiers » web button
  3. A native MS Windows opens. I must enter a file name and its path in a control edit, click the “Open” button BUT I don’t know how to do it
  4. I follows testcase steps by clicking on “Tout télécharger” button etc.

You don’t need to touch the “ajouter des fichiers” dialog at all. If I understand correctly, what you’re trying to do is upload file(s).

Find the element in the HTML that deals with the file…

<input type="file" ...>

Then use

WebUI.uploadFile(findTestObject('input_file'), 'my-file..png')
2 Likes

Great Russ it works now! Really thank you for the help.
I declare the web object with the input type file found into html xpath (ex: input_file1 with xpath = //*[@id=“form:j_idt132_input”]), so without click on my object and using uploadFile only, it works:

// Open the web popup for uploading
WebUI.click(findTestObject(‘AddFile_button’))
// select the files to upload
WebUI.uploadFile(findTestObject(‘UploadFileWindows/input_file1’), ‘D://myfile1.zip’)
WebUI.uploadFile(findTestObject(‘UploadFileWindows/input_file1’), ‘D://myfile2.zip’)
// etc. if many files to load
WebUI.delay(2)
// Send all the selected files
WebUI.click(findTestObject(‘UploadAll_Button’))
WebUI.delay(3)

2 Likes

Thank you @thierry.gonzalvez for your confirmation, would you help summarize the solution and mark it for other users’ future reference? See how to mark solution in this post Show your appreciation through LIKES and SOLUTION MARKS - Everything you need to know!.

Thank you @Russ_Thomas for all your help!