Showing posts with label Sending special keys and key event. Show all posts
Showing posts with label Sending special keys and key event. Show all posts

Wednesday, 16 January 2013

Sending special keys and key event in selenium webdriver

Sending special keys and key event in selenium webdriver

Use the Below Code:

//Sending F5 key  
driver.findElement(By.id("name")).sendKeys(Keys.F5);  
  
//Sending arrow down key   
driver.findElement(By.id("name")).sendKeys(Keys.ARROW_DOWN);  

//sending Escape key  
driver.findElement(By.id("name")).sendKeys(Keys.ESCAPE);
  
//sending pagedown key from keyboard  
driver.findElement(By.id("name")).sendKeys(Keys.PAGE_DOWN);  
  
//sending space key   
driver.findElement(By.id("name")).sendKeys(Keys.SPACE);  
  
//sending tab key  
driver.findElement(By.id("name")).sendKeys(Keys.TAB);  
  
//sending alt key  
driver.findElement(By.id("name")).sendKeys(Keys.ALT);