forked from TalhaBinAshraf1/SeleniumTestingInternetHerokuApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyPresses.java
More file actions
24 lines (19 loc) · 795 Bytes
/
Copy pathKeyPresses.java
File metadata and controls
24 lines (19 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package allTests;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import utility.FrameworkConstants;
public class KeyPresses {
public static void main(String[] args) throws InterruptedException {
System.setProperty(FrameworkConstants.CHROME_DRIVER_KEY,FrameworkConstants.CHROME_DRIVER_PATH);
WebDriver driver = new ChromeDriver();
driver.get("http://the-internet.herokuapp.com/");
driver.findElement(By.xpath("//a[contains(text(),'Key Presses')]")).click();
Actions action = new Actions(driver);
action.sendKeys("S").perform();;
System.out.println(driver.findElement(By.cssSelector("p#result")).getText());
Thread.sleep(3000);
driver.quit();
}
}