Skip to content

Instantly share code, notes, and snippets.

@c089
Created November 10, 2011 15:55
Show Gist options
  • Save c089/1355195 to your computer and use it in GitHub Desktop.
Save c089/1355195 to your computer and use it in GitHub Desktop.
Hover Test
package frontend;
import junit.framework.TestCase;
import org.junit.Test;
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 WebDriverHoverAcceptanceTest extends TestCase {
@Test
public void testThatWeCanFinallyHoverAgain() {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.lusini.de/search/#/bruce");
WebElement firstProduct = driver.findElement(By.className("gridItem"));
WebElement quickViewLink = firstProduct.findElement(By.className("quickview"));
WebElement productImage = firstProduct.findElement(By.className("gridProductImage"));
assertEquals("a", quickViewLink.getTagName());
assertFalse(quickViewLink.isDisplayed());
new Actions(driver).moveToElement(productImage).perform();
assertTrue(quickViewLink.isDisplayed());
assertEquals("Schnellansicht", quickViewLink.getText());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment