Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- private static EdgeDriverService service;
- private static WebDriver driver;
- private static void createAndStartService() {
- try {
- service = new EdgeDriverService.Builder()
- .usingDriverExecutable(new File("C:\\Windows\\SysWOW64\\MicrosoftWebDriver.exe"))
- .usingAnyFreePort()
- .build();
- service.start();
- }
- catch (IOException e) {
- //
- }
- }
- private static void init() {
- createAndStartService();
- driver = new RemoteWebDriver(service.getUrl(), DesiredCapabilities.edge());
- }
- public static void main(String[] args) {
- init();
- driver.get("http://www.google.com");
- //driver.findElement(By.xpath("//*[@id=\"tsf\"]/div[2]/div/div[1]/div/div[1]/input")).sendKeys("Bla bla bla");
- driver.findElement(By.xpath("//*[@id=\"tsf\"]/div[2]/div/div[1]/div/div[1]/input")).sendKeys(org.openqa.selenium.Keys.F5);
- driver.quit();
- service.stop();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement