-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstub.java21-sel
31 lines (22 loc) · 961 Bytes
/
stub.java21-sel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
public class Source {
//Do not change this url. Otherwise your evaluation will fail
public static final String URL = "http://127.0.0.1:4444/wd/hub";
public static void main(String[] args) throws Exception {
//Do not change the below line. Otherwise your evaluation will fail
DesiredCapabilities caps = DesiredCapabilities.phantomjs();
WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Hello, World!");
element.submit();
System.out.println(driver.getTitle());
driver.quit();
}
}