Created
July 2, 2017 00:13
-
-
Save michelpf/26edc4b4bd34ce2367f9d847a7806c09 to your computer and use it in GitHub Desktop.
Exemplo de Java com Selenium realizando interações
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
public class Main { | |
public static void main(String[] args) { | |
File file = new File("drivers/IEDriverServer.exe"); | |
System.setProperty("webdriver.ie.driver", file.getAbsolutePath()); | |
WebDriver driver = new InternetExplorerDriver(); | |
driver.get("http://michelpf.com/exemplo-de-calculadora-em-javascript/"); | |
driver.findElement(By.xpath("//input[@id='1']")).click(); | |
driver.findElement(By.xpath("//input[@id='plus']")).click(); | |
driver.findElement(By.xpath("//input[@id='6']")).click(); | |
driver.findElement(By.xpath("//input[@id='equals']")).click(); | |
String result = driver.findElement(By.xpath("//input[@id='Resultbox']")).getAttribute("value"); | |
System.out.println("Resultado 1+6 = " + result); | |
driver.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment