|
6 | 6 | import io.cucumber.java.en.Given; |
7 | 7 | import io.cucumber.java.en.Then; |
8 | 8 | import io.cucumber.java.en.When; |
| 9 | +import org.openqa.selenium.By; |
9 | 10 | import org.openqa.selenium.WebElement; |
10 | 11 | import org.openqa.selenium.chrome.ChromeOptions; |
11 | 12 | import org.openqa.selenium.remote.RemoteWebDriver; |
|
21 | 22 |
|
22 | 23 | public class Stepdefs { |
23 | 24 |
|
24 | | - private BrowserWebDriverContainer container = new BrowserWebDriverContainer() |
| 25 | + private final BrowserWebDriverContainer<?> container = new BrowserWebDriverContainer<>("selenium/standalone-chrome:4") |
25 | 26 | .withCapabilities(new ChromeOptions()) |
26 | 27 | .withRecordingMode(RECORD_ALL, new File("build")); |
27 | 28 |
|
@@ -49,20 +50,20 @@ public String getFilesystemFriendlyName() { |
49 | 50 | } |
50 | 51 |
|
51 | 52 | @Given("^location is \"([^\"]*)\"$") |
52 | | - public void locationIs(String location) throws Exception { |
| 53 | + public void locationIs(String location) { |
53 | 54 | this.location = location; |
54 | 55 | } |
55 | 56 |
|
56 | 57 | @When("^I ask is it possible to search here$") |
57 | | - public void iAskIsItPossibleToSearchHere() throws Exception { |
58 | | - RemoteWebDriver driver = container.getWebDriver(); |
| 58 | + public void iAskIsItPossibleToSearchHere() { |
| 59 | + RemoteWebDriver driver = new RemoteWebDriver(container.getSeleniumAddress(), new ChromeOptions()); |
59 | 60 | driver.get(location); |
60 | | - List<WebElement> searchInputs = driver.findElementsByTagName("input"); |
| 61 | + List<WebElement> searchInputs = driver.findElements(By.tagName("input")); |
61 | 62 | answer = searchInputs != null && searchInputs.size() > 0 ? "YES" : "NOPE"; |
62 | 63 | } |
63 | 64 |
|
64 | 65 | @Then("^I should be told \"([^\"]*)\"$") |
65 | | - public void iShouldBeTold(String expected) throws Exception { |
| 66 | + public void iShouldBeTold(String expected) { |
66 | 67 | assertEquals(expected, answer); |
67 | 68 | } |
68 | 69 |
|
|
0 commit comments