Quality Testing

Quality is delighting customers

Hi Friends,

I am useing Selenium RC. And in Want to Press Ctrl key in the Keybord and click a value in the browser. How to proceed.

I tried with keypress event , but i dont know how to work with it? Can anybody help me in this.Thanks in advance.

Regards

Sakthy

Views: 426

Reply to This

Replies to This Discussion

Hi,

If you are using Selenium Rc with Java then you can use java.awt.robot class where you can use the key events:

import java.awt.Robot;
import java.awt.event.KeyEvent;

And

robot.keyPress(KeyEvent.VK_H);
robot.keyPress(KeyEvent.VK_I);
robot.keyPress(KeyEvent.VK_SPACE);
robot.keyPress(KeyEvent.VK_B);
robot.keyPress(KeyEvent.VK_U);
robot.keyPress(KeyEvent.VK_D);
robot.keyPress(KeyEvent.VK_Y);

Hi,

selenium.keyDownNative(Integer.toString(KeyEvent.VK_SHIFT));
        selenium.keyPressNative(String.valueOf(KeyEvent.VK_D));
        selenium.keyUpNative(Integer.toString(KeyEvent.VK_SHIFT));
        //selenium.keyDownNative(Integer.toString(KeyEvent.VK_SHIFT));
        selenium.keyPressNative(Integer.toString(KeyEvent.VK_SEMICOLON));
        selenium.keyUpNative(Integer.toString(KeyEvent.VK_SHIFT));
        selenium.keyPressNative(Integer.toString(KeyEvent.VK_SLASH));
        selenium.keyPressNative(String.valueOf(KeyEvent.VK_S));
        selenium.keyPressNative(String.valueOf(KeyEvent.VK_E));
        selenium.keyPressNative(String.valueOf(KeyEvent.VK_L));
        selenium.keyPressNative(String.valueOf(KeyEvent.VK_E));
        selenium.keyPressNative(String.valueOf(KeyEvent.VK_N));

Thanks for ur reply Umamahesh. I found the solution by using selenium.controlKeyDown(); then selenium.click(); 

This solved my problem

Regards

Sakthy

Ur WelCome Dude...........:-)

Regards

MAhesh

PLZ check this 

http://www.qualitytesting.info/forum/topics/how-to-handel-autocompl...

and if u know help me dude.

Regards

Sakthy

Thanks foro ur reply sarita. I found the solution by using selenium.controlKeyDown(); then selenium.click(); 

This solved my problem

Regards

Sakthy

RSS

TTWT Magazine

Advertisement

Advertisement

Advertisement

Submit A Tool

Advertisement



Videos

  • Add Videos
  • View All

Badge

Loading…

© 2014   Created by Quality Testing.

Badges  |  Report an Issue  |  Terms of Service