|
21 | 21 | import org.openqa.selenium.WebDriver;
|
22 | 22 | import org.openqa.selenium.chromium.ChromiumDriver;
|
23 | 23 | import org.openqa.selenium.chromium.ChromiumDriverCommandExecutor;
|
24 |
| -import org.openqa.selenium.html5.LocationContext; |
25 |
| -import org.openqa.selenium.html5.WebStorage; |
26 | 24 | import org.openqa.selenium.remote.RemoteWebDriver;
|
27 | 25 |
|
28 | 26 | /**
|
29 | 27 | * A {@link WebDriver} implementation that controls a Chrome browser running on the local machine.
|
30 |
| - * This class is provided as a convenience for easily testing the Chrome browser. The control server |
31 |
| - * which each instance communicates with will live and die with the instance. |
| 28 | + * It requires a <code>chromedriver</code> executable to be available in PATH. |
32 | 29 | *
|
33 |
| - * To avoid unnecessarily restarting the ChromeDriver server with each instance, use a |
34 |
| - * {@link RemoteWebDriver} coupled with the desired {@link ChromeDriverService}, which is managed |
35 |
| - * separately. For example: <pre>{@code |
36 |
| - * |
37 |
| - * import static org.junit.Assert.assertEquals; |
38 |
| - * |
39 |
| - * import org.junit.*; |
40 |
| - * import org.junit.runner.RunWith; |
41 |
| - * import org.junit.runners.JUnit4; |
42 |
| - * import org.openqa.selenium.By; |
43 |
| - * import org.openqa.selenium.WebDriver; |
44 |
| - * import org.openqa.selenium.WebElement; |
45 |
| - * import org.openqa.selenium.chrome.ChromeDriverService; |
46 |
| - * import org.openqa.selenium.chrome.ChromeOptions; |
47 |
| - * import org.openqa.selenium.remote.RemoteWebDriver; |
48 |
| - * |
49 |
| - * import java.io.File; |
50 |
| - * import java.io.IOException; |
51 |
| - * |
52 |
| - * {@literal @RunWith(JUnit4.class)} |
53 |
| - * public class ChromeTest { |
54 |
| - * |
55 |
| - * private static ChromeDriverService service; |
56 |
| - * private WebDriver driver; |
57 |
| - * |
58 |
| - * {@literal @BeforeClass} |
59 |
| - * public static void createAndStartService() throws IOException { |
60 |
| - * service = new ChromeDriverService.Builder() |
61 |
| - * .usingDriverExecutable(new File("path/to/my/chromedriver.exe")) |
62 |
| - * .usingAnyFreePort() |
63 |
| - * .build(); |
64 |
| - * service.start(); |
65 |
| - * } |
66 |
| - * |
67 |
| - * {@literal @AfterClass} |
68 |
| - * public static void createAndStopService() { |
69 |
| - * service.stop(); |
70 |
| - * } |
71 |
| - * |
72 |
| - * {@literal @Before} |
73 |
| - * public void createDriver() { |
74 |
| - * driver = new RemoteWebDriver(service.getUrl(), new ChromeOptions()); |
75 |
| - * } |
76 |
| - * |
77 |
| - * {@literal @After} |
78 |
| - * public void quitDriver() { |
79 |
| - * driver.quit(); |
80 |
| - * } |
81 |
| - * |
82 |
| - * {@literal @Test} |
83 |
| - * public void testGoogleSearch() { |
84 |
| - * driver.get("http://www.google.com"); |
85 |
| - * WebElement searchBox = driver.findElement(By.name("q")); |
86 |
| - * searchBox.sendKeys("webdriver"); |
87 |
| - * searchBox.sendKeys(Keys.ENTER); |
88 |
| - * assertEquals("webdriver - Google Search", driver.getTitle()); |
89 |
| - * } |
90 |
| - * } |
91 |
| - * }</pre> |
92 |
| - * |
93 |
| - * Note that unlike ChromeDriver, RemoteWebDriver doesn't directly implement |
94 |
| - * role interfaces such as {@link LocationContext} and {@link WebStorage}. |
95 |
| - * Therefore, to access that functionality, it needs to be |
96 |
| - * {@link org.openqa.selenium.remote.Augmenter augmented} and then cast |
97 |
| - * to the appropriate interface. |
98 |
| - * |
99 |
| - * @see ChromeDriverService#createDefaultService |
| 30 | + * @see <a href="https://sites.google.com/a/chromium.org/chromedriver/">chromedriver</a> |
100 | 31 | */
|
101 | 32 | public class ChromeDriver extends ChromiumDriver {
|
102 | 33 |
|
|
0 commit comments