dimanche 4 mars 2018

How I can click on element which appers when I mouse over?

I am trying to execute below code, I am able to perform mouse over but unable to click on element which appears after mouse over.

System.out.println("start");
System.setProperty("webdriver.gecko.driver","C:\\SeleniumGecko\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://www.amazon.in/");
Actions action = new Actions(driver);
WebElement mouse=driver.findElement(By.className("nav-line-2"));
action.moveToElement(mouse).perform();
Thread.sleep(10000);
WebElement clickElement= driver.findElement(By.className("nav-a"));// the Element which I want clcik
action.moveToElement(clickElement).click().perform();
System.out.println("stop"); 

Aucun commentaire:

Enregistrer un commentaire