Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save udayanem/fbd78fcffc9b48018ff6 to your computer and use it in GitHub Desktop.
Save udayanem/fbd78fcffc9b48018ff6 to your computer and use it in GitHub Desktop.
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class ActBuilder
{
public static void main(String[] args) throws InterruptedException
{
WebDriver driver=new FirefoxDriver();
driver.get("http://www.flipkart.com/");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
WebElement ele=driver.findElement(By.xpath("//li[@class='menu-l0 ' and @data-key='electronics']"));
Actions builder=new Actions(driver);
// builder.moveToElement(ele).build().perform();
builder.moveToElement(ele).perform();
Thread.sleep(2000);
WebElement nexus=driver.findElement(By.xpath("//a[@data-tracking-id='0_Nexus 6']"));
// nexus.click();
// builder.moveToElement(nexus).click().build().perform();
builder.click(nexus).build().perform();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment