Selenium "shiftKeyDown" and "shiftKeyUp" commands example to press shift key

"shiftKeyDown" and "shiftKeyUp" commands are specially designed for shift key of keyboard. Selenium IDE has many commands related to keyboard keys(Example : keyDown) and mouse keys (Example : mouseDown). "shiftKeyDown" and "shiftKeyUp" has not major function but sometimes such specially
designed commands are very helpful in automation tools to automate your regression process easy and smooth.

Using "shiftKeyDown" Command
You can understand "shiftKeyDown" command's function from its name. It works like user is pressing and holding shift key of keyboard. Shift key not released until "shiftKeyUp" command executed.

Selenium IDE "shiftKeyUp" Command
"shiftKeyUp" command is useful to release pressed key through "shiftKeyDown" command. Bellow given example described both command's function very clearly.

New Test
CommandTargetValue
openhttp://www.google.com
shiftKeyDown

type//input[@id='gbqfq']hello friends
click//button[@id='gbqfb']
pause3000
shiftKeyUp

type//input[@id='gbqfq']hello friends
click//button[@id='gbqfb']

In above example, 1st "type" command will type word "HELLO FRIENDS" (in capital letter because shift key is pressed using "shiftKeyDown") in Google search box. 2nd type command will type "hello friends" in small letter because now shift key is released using "shiftKeyUp" in previous command.

1 comment: