How to send keys from keyboard for CTRL + V for COPY/PASTE?

To Copying the word or sentence and Pasting into the input field, we can use character sequence in selenium scripts.

Below is an example to paste the search queries on Google Search Engine.

Note : Before that open your notepad.  Key something which you would like to search, I had written on my notepad "World Wrestling Entertainment" and copied using CTRL + C.

Now try the below code for pasting into the search input box.

Code:
import java.util.List;
import java.util.concurrent.TimeUnit;  

import org.openqa.selenium.*;  
import org.openqa.selenium.firefox.FirefoxDriver;  

public class CtrlC{
public static void main(String[] args) throws InterruptedException{

//Launching firefox Browser
WebDriver driver = new FirefoxDriver();

//Launching google search 
driver.get("http://www.google.com");

Thread.sleep(5000);

driver.findElement(By.name("q")).sendKeys(Keys.CONTROL + "v");

}
}
Socialize It and Share the post with your friends
SOCIALIZE IT →
FOLLOW US →
SHARE IT →