Created
May 8, 2014 08:22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.tests; | |
import java.util.concurrent.TimeUnit; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
import org.openqa.selenium.interactions.Actions; | |
import org.testng.annotations.AfterSuite; | |
import org.testng.annotations.BeforeSuite; | |
import org.testng.annotations.Test; | |
public class OpenLinkInNewWindowExample { | |
private WebDriver driver; | |
@BeforeSuite | |
public void setUp() throws Exception { | |
driver = new FirefoxDriver(); | |
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); | |
} | |
@AfterSuite | |
public void tearDown() throws Exception { | |
driver.quit(); | |
} | |
@Test | |
public void testMethod(){ | |
driver.get("http://www.w3schools.com/"); | |
Actions action = new Actions(driver); | |
action.contextClick(driver.findElement(By.linkText("Learn HTML"))).perform(); | |
action.sendKeys("w").perform(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment