Combo of keystrokes not working

I need to send a combination of key strokes in a test case. These keys below act as hotkeys and do things like open a pop up box, or open another window with some content. I can successfully send ones such as:

F1
WebUI.sendKeys(findTestObject(null), Keys.chord(Keys.F1))

Shift-F3
WebUI.sendKeys(findTestObject(null), Keys.chord(Keys.SHIFT, Keys.F3))

Shift-F4
WebUI.sendKeys(findTestObject(null), Keys.chord(Keys.SHIFT, Keys.F4))

Control-A
WebUI.sendKeys(findTestObject(‘Add Bill/Page_/input_Shipper_1’), Keys.chord(Keys.CONTROL, ‘a’))

When I try and use ALT in a combination with a letter, and set the letter as a string, it is not working…any suggestions?

ALT-E - Enters some default text into a field
WebUI.sendKeys(findTestObject(null), Keys.chord(Keys.ALT, ‘E’))

Alt-Q - Clears all the fields on the screen
WebUI.sendKeys(findTestObject(null), Keys.chord(Keys.ALT, ‘Q’))

I figured this out, after banging my head for a few days, it was simple fix. I was using capital letters in the keys.chord statement. Once I made it lowercase, it worked.

Old code:

WebUI.sendKeys(findTestObject(null), Keys.chord(Keys.ALT, ‘E’))

WebUI.sendKeys(findTestObject(null), Keys.chord(Keys.ALT, ‘Q’))

New code:

WebUI.sendKeys(findTestObject(null), Keys.chord(Keys.ALT, ‘e’))

WebUI.sendKeys(findTestObject(null), Keys.chord(Keys.ALT, ‘q’))

1 Like