WebUI Firefox SendKeys Method Not Working For "Backspace" Key

The expected behavior I want to see is the deletion of the last character in a textbox. I’m running into a problem in Firefox where the SendKeys method deletes the character as expected, but leaves a box symbol in its place at the end like so:

This does not occur when I use Chrome. This is the code I use to send the “backspace” key:

WebUI.click(findTestObject(testObjectPath))

WebUI.sendKeys(findTestObject(testObjectPath), Keys.chord(Keys.BACK_SPACE))

If anyone knows how to deal with this issue it would be greatly appreciated. Thanks!

Screen Shot 2018-07-11 at 10.22.38 AM.png

Screen Shot 2018-07-11 at 10.23.05 AM.png

Jeremy Lipschutz said:

The expected behavior I want to see is the deletion of the last character in a textbox. I’m running into a problem in Firefox where the SendKeys method deletes the character as expected, but leaves a box symbol in its place at the end like so:

This does not occur when I use Chrome. This is the code I use to send the “backspace” key:

WebUI.click(findTestObject(testObjectPath))

WebUI.sendKeys(findTestObject(testObjectPath), Keys.chord(Keys.BACK_SPACE))

If anyone knows how to deal with this issue it would be greatly appreciated. Thanks!

Are you trying to delete the odd character generated when you send the enter key?

No, I just want the last character deleted. The expected output for those text boxes should be “Seattl” and “9810”, but in Firefox they are those images above.

Anthony said:

Jeremy Lipschutz said:

The expected behavior I want to see is the deletion of the last character in a textbox. I’m running into a problem in Firefox where the SendKeys method deletes the character as expected, but leaves a box symbol in its place at the end like so:

This does not occur when I use Chrome. This is the code I use to send the “backspace” key:

WebUI.click(findTestObject(testObjectPath))

WebUI.sendKeys(findTestObject(testObjectPath), Keys.chord(Keys.BACK_SPACE))

If anyone knows how to deal with this issue it would be greatly appreciated. Thanks!

Are you trying to delete the odd character generated when you send the enter key?

No, I just want the last character deleted. The expected output for those text boxes should be “Seattl” and “9810”, but in Firefox they are those images above.

Jeremy Lipschutz said:

No, I just want the last character deleted. The expected output for those text boxes should be “Seattl” and “9810”, but in Firefox they are those images above.

Ah I got those Unicode sort of characters when I was using Katalon to press ENTER, anyway using robot to press Backspace might do it for you

http://forum.katalon.com/discussion/6800/how-to-press-enter-with-webui <- see first response and change enter to back space

Any solution for above problem

Anthony’s last response worked for me if I remember correctly. The link isn’t available however so you will want to do more digging. Sorry.

Hello, were you able to find a solution for this? I am also trying to use backspace and it creates a unicode in the tab. robot code did not help me either. Please post the solution if you get one. Thanks

1 Like

The issue is still open and on their backlog.

As a temporary workaround you can:

  1. Retrieve the current object text
    String text = WebUI.getText()
  2. Then provide a substring back into your object
    WebUI.setText(text.substring(o,text.length-1)

Is this a FireFox driver or a Katalon Studio issue? Wondering when this issue will be repaired?

1 Like

@charles have you heard any answers to this?

I also have this problem right now, testing on Firefox and want to clear a TextField
using
Keys.chord(Keys.CONTROL, ‘a’)
Keys.chord(Keys.BACK_SPACE)

But the workaround with Robot worked fine, and I wrote my own “clearText”-method:

import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import org.openqa.selenium.Keys as Keys
import java.awt.Robot as Robot
import java.awt.event.KeyEvent as KeyEvent
    
class TestUtilities {

	static void clearText(TestObject testObject) {
	
    	WebUI.click(testObject)
	
    	WebUI.sendKeys(testObject,
    		Keys.chord(Keys.CONTROL, 'a'))
	
    	Robot robot = new Robot()
    	robot.keyPress(KeyEvent.VK_BACK_SPACE)
    	robot.keyRelease(KeyEvent.VK_BACK_SPACE)
    }

}