You can build a perform series of actions using the Action and Actions classes. Just remember to close the series with the build() method. Consider the sample code below.

package learnAboutActionsClass;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class PerformSeriesOfActions {
public static void main(String[] args) {
// TODO Auto-generated method stub
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.navigate().to("https://www.facebook.com/");
WebElement element = driver.findElement(By.xpath("//*[@id='email']"));
Actions act = new Actions(driver);
//Below line sends some text to field by converting it to uppercase, then double click the text so that it will select all, then do right click
act.moveToElement(element).click().keyDown(element, Keys.SHIFT).sendKeys("panarkhede").keyUp(element, Keys.SHIFT).doubleClick(element).contextClick(element).build().perform();
driver.quit();
}
}
