Skip to content

Commit 0adaa73

Browse files
committed
[java] Fixing code example in ChromeDriver javadoc [skip ci]
1 parent 02c0f57 commit 0adaa73

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

java/client/src/org/openqa/selenium/chrome/ChromeDriver.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,24 @@
3939
* import org.junit.*;
4040
* import org.junit.runner.RunWith;
4141
* import org.junit.runners.JUnit4;
42+
* import org.openqa.selenium.By;
43+
* import org.openqa.selenium.WebDriver;
44+
* import org.openqa.selenium.WebElement;
4245
* import org.openqa.selenium.chrome.ChromeDriverService;
43-
* import org.openqa.selenium.remote.DesiredCapabilities;
46+
* import org.openqa.selenium.chrome.ChromeOptions;
4447
* import org.openqa.selenium.remote.RemoteWebDriver;
4548
*
49+
* import java.io.File;
50+
* import java.io.IOException;
51+
*
4652
* {@literal @RunWith(JUnit4.class)}
47-
* public class ChromeTest extends TestCase {
53+
* public class ChromeTest {
4854
*
4955
* private static ChromeDriverService service;
5056
* private WebDriver driver;
5157
*
5258
* {@literal @BeforeClass}
53-
* public static void createAndStartService() {
59+
* public static void createAndStartService() throws IOException {
5460
* service = new ChromeDriverService.Builder()
5561
* .usingDriverExecutable(new File("path/to/my/chromedriver.exe"))
5662
* .usingAnyFreePort()
@@ -65,8 +71,7 @@
6571
*
6672
* {@literal @Before}
6773
* public void createDriver() {
68-
* driver = new RemoteWebDriver(service.getUrl(),
69-
* DesiredCapabilities.chrome());
74+
* driver = new RemoteWebDriver(service.getUrl(), new ChromeOptions());
7075
* }
7176
*
7277
* {@literal @After}
@@ -79,7 +84,7 @@
7984
* driver.get("http://www.google.com");
8085
* WebElement searchBox = driver.findElement(By.name("q"));
8186
* searchBox.sendKeys("webdriver");
82-
* searchBox.quit();
87+
* searchBox.sendKeys(Keys.ENTER);
8388
* assertEquals("webdriver - Google Search", driver.getTitle());
8489
* }
8590
* }

0 commit comments

Comments
 (0)