package New;
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;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
public class Mouse_Over {
WebDriver driver;
@Test
public void mouesover() throws InterruptedException {
driver.get("http://www.flipkart.com/");
// WebElement element= driver.findElement(By.xpath("//span[text()='Electronics']"));
WebElement element= driver.findElement(By.xpath("//a[@data-tracking-id='electronics']"));
Actions a =new Actions(driver);
a.moveToElement(element).build().perform();
// a.clickAndHold(element);
Thread.sleep(5000);
//WebDriverWait wd=new WebDriverWait(driver, 30);
}
@BeforeClass
public void beforeClass() {
driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
}
@AfterClass
public void afterClass() {
driver.quit();
}
}
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;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
public class Mouse_Over {
WebDriver driver;
@Test
public void mouesover() throws InterruptedException {
driver.get("http://www.flipkart.com/");
// WebElement element= driver.findElement(By.xpath("//span[text()='Electronics']"));
WebElement element= driver.findElement(By.xpath("//a[@data-tracking-id='electronics']"));
Actions a =new Actions(driver);
a.moveToElement(element).build().perform();
// a.clickAndHold(element);
Thread.sleep(5000);
//WebDriverWait wd=new WebDriverWait(driver, 30);
}
@BeforeClass
public void beforeClass() {
driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
}
@AfterClass
public void afterClass() {
driver.quit();
}
}
No comments:
Post a Comment