Thursday, March 7, 2019

Mouse Movement in Selenium

 package learning;  
 import java.util.concurrent.TimeUnit;  
 import org.openqa.selenium.By;  
 import org.openqa.selenium.WebDriver;  
 import org.openqa.selenium.chrome.ChromeDriver;  
 import org.openqa.selenium.interactions.Actions;  
 public class MoveMouse {  
      public static void main(String[] args) throws Exception {  
           System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");  
           WebDriver driver = new ChromeDriver();  
           driver.manage().window().maximize();  
           driver.manage().deleteAllCookies();  
           driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);  
           driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);  
           driver.get("https://www.spicejet.com");  
           Actions actions = new Actions(driver);  
           actions.moveToElement(driver.findElement(By.linkText("ADD-ONS"))).build().perform();  
           Thread.sleep(3000);  
           driver.findElement(By.linkText("Dubai Visa Services")).click();  
      }  
 }  

No comments:

Post a Comment