Unable to Set text a full variable in Windows Element


I’m trying to set text in a Windows element on File Explorer. The test case pass but instead of setting all the text, it sets the variable character by character. For example, if I try to set the word “Test”, it’ll set “t”, then “e”, then “s” and finally “t”. But it also clear the all element betxeen every character.

I tried by using Set text method and also Send Keys. No difference. I tried by using an variable also. I don’t have this behavior on Web Elements.

What can I do to be able to set the all variable ?

My script if it helps :

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



Windows.sendKeys(findWindowsObject('WIN-Explorateur-Fichiers/Recherche'), 'test')

Windows.sendKeys(findWindowsObject('WIN-Explorateur-Fichiers/Recherche'), Keys.chord(Keys.ENTER))

I also think I shouldn’t need to click in the element before setting the text, but if I don’t do it the explorer crashes.

Thank you for your help

Hi @achapel

I just have a question regarding what it is you want to accomplish. Are you trying to rename a file or folder through the windows explorer?

Hi @jmeintjesn7 ,

No I want to find a specific file in a specific folder (Downloads actually). So far I have troubles just typing an entire file name so i didn’t go any further. My intention is to use a variable for the file name in next steps.

I have manage to navigate to MyDocuments and then search for a file name which has been set as a variable and then open the file by pressing enter on it. What I am suspecting is that you are sending the key presses to the test object used to navigate to ‘Downloads’ instead of sending the keypresses to the object you actually use to search with (your test objects for Windows.click and Windows.sendKeys are the exact same)

Here is my code:

def fileName = 'test'

Windows.startApplicationWithTitle('C:\\Windows\\explorer.exe', '')

Windows.click(findWindowsObject('Object Repository/WindowsObjects/MyDocuments'))

Windows.sendKeys(findWindowsObject('Object Repository/WindowsObjects/DocumentsWindow'), fileName)

Windows.sendKeys(findWindowsObject('Object Repository/WindowsObjects/DocumentsWindow'), Keys.chord(Keys.ENTER))

Note that my test object “DocumentsWindow” is set to the area containing my files/folders as shown below:

What it looks like in Spy Windows Objects


Hi @jmeintjesn7

Thank you for your answer. I don’t understand why but it’s still writing character by character… I found another solution to avoid this process. Thank you anyway :slight_smile: