Skip to content

Commit

Permalink
Add time limit and retry to instantiation of RemoteWebDriver
Browse files Browse the repository at this point in the history
Resolves #373
  • Loading branch information
rnorth committed Jun 27, 2017
1 parent 1b89280 commit fffb978
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.rnorth.ducttape.timeouts.Timeouts;
import org.rnorth.ducttape.unreliables.Unreliables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.traits.LinkableContainer;
Expand All @@ -20,6 +22,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.concurrent.TimeUnit;

import static com.google.common.base.Preconditions.checkState;
import static java.time.temporal.ChronoUnit.SECONDS;
Expand Down Expand Up @@ -157,7 +160,11 @@ protected void containerIsStarted(InspectContainerResponse containerInfo) {
recordingSidekickContainer.start();
currentVncRecordings.add(recordingSidekickContainer);
}
this.driver = new RemoteWebDriver(getSeleniumAddress(), desiredCapabilities);

driver = Unreliables.retryUntilSuccess(30, TimeUnit.SECONDS,
Timeouts.getWithTimeout(10, TimeUnit.SECONDS,
() ->
() -> new RemoteWebDriver(getSeleniumAddress(), desiredCapabilities)));
}

/**
Expand Down

0 comments on commit fffb978

Please sign in to comment.