How to write hyphen minus in katalon

Hello,

I am triying to write this text “Hi - Test” with the items “Set Text” and “Send Keys”.

But when i execute the test it writes “Hi ’ Test”.
image

How can i write the hyphen minus “-”.??

Thank you!

Can you share your test code?

1 Like

This is mi code:

Windows.sendKeys(findWindowsObject(‘Object Repository/Object1’),
‘Pruebas - Test’)

Windows.setText(findWindowsObject(‘Object Repository/Object1’),
‘Pruebas - Test’)

And it writes Pruebas ’ Test.

Wild guess…

String hyhen = "-"
Windows.setText(findWindowsObject("Object Repository/Object1"),
"Pruebas ${hyphen} Test")

Hi,

Using this code:

String hyhen = “-”
Windows.setText(findWindowsObject(“Object Repository/Object1”),hyphen).

It writes:
image

And using this code:
Using this code:

String hyhen = “-”
Windows.setText(findWindowsObject(“Object Repository/Object1”), ‘Pruebas ${hyphen} test’)

It writes:
image

So I still can’t write the “-”.

Pay attention to your quotes! Copy mine EXACTLY as I wrote them.

@pablo.alvarez

You should change the text in single quote to double quote to use Groovy GString.

If your default keyword is not English, you should change to English. Related issue: https://github.com/Microsoft/WinAppDriver/issues/446

1 Like

I agree, I think the double quotes will fix it:

Windows.setText(findWindowsObject("Object Repository/Object1"),
"Pruebas - Test")

You may be or may not be aware, there are several characters defined in UNICODE that looks similar to “Hyphen-minus”(Unicode 002D). See

@pablo.alvarez, you should verify which Unicode character you typed. I have a doubt that you typed U+2010 or U+2011 or U+2212 or U+2013 or U+2014, not U+002D. You should check your source using some binary editor and see the source in HEX-decimal. In Katalon Studio, you can not see the source in HEX-decimal. You need some other tool. For example, I would use VSCode with Hex Editor

1 Like

Hi @Russ_Thomas , @duyluong and @Brandon_Hein:

Using double quotes not solved the problem.

The code:

The result:
image

Hi!

How its possible to set text with unicode?¿

Thank you!

Then try to follow the information provided above – you are likely not providing a true hyphen/minus but something else, which, depending on the character set in use at the time, is an entirely different character. That’s an almost impossible thing for us to debug remotely.

Understand: No one else (that we’re aware of) is suffering from this issue. :confused:

Let’s see if we can debug the string at least. Put this in the browser console:

var s = "Pruebas - Test"; for(var i = 0; i < s.length; i++) console.log(s.charCodeAt(i));

But DO NOT COPY MY CODE above – it’s important you take a copy of YOUR “pruebas” string with the hyphen from from YOUR SYSTEM.

You should see this in the console:

Notice the sequence 32 45 32 that is space-hyphen-space. Perhaps yours says something different?

Sorry but i am not understanding you.

I have the problem testing a windows 10 application, in web i dont have this problem.

So i dont understand how to use the console with desktop application.

Thank you!

You can still use a browser console to test a string.

If I test the string you placed here, I’m getting this character: https://unicodeplus.com/U+2019

8217 decimal is 2019 hex.

If i test my string, i’m getting the hyperminus value 45.
image

But it writes the unicode : https://unicodeplus.com/U+2019

Is the AUT using the correct locale/codepage and keyboard settings?

My keyboard and system are in Spanish but katalon is in English.

It´s the only difference.

And what about the AUT (the app you’re testing)?

It´s in spanish too. Using es-ES language settings.