Skip to content

Commit a248f5d

Browse files
authored
Merge branch 'trunk' into pinned-browser-updates
2 parents 8cfa301 + 1cad0ca commit a248f5d

File tree

14 files changed

+46
-162
lines changed

14 files changed

+46
-162
lines changed

java/src/org/openqa/selenium/WebDriver.java

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -295,26 +295,6 @@ interface Options {
295295
*/
296296
interface Timeouts {
297297

298-
/**
299-
* @deprecated Use {@link #implicitlyWait(Duration)}
300-
* <p>Specifies the amount of time the driver should wait when searching for an element if
301-
* it is not immediately present.
302-
* <p>When searching for a single element, the driver should poll the page until the element
303-
* has been found, or this timeout expires before throwing a {@link NoSuchElementException}.
304-
* When searching for multiple elements, the driver should poll the page until at least one
305-
* element has been found or this timeout has expired.
306-
* <p>Increasing the implicit wait timeout should be used judiciously as it will have an
307-
* adverse effect on test run time, especially when used with slower location strategies
308-
* like XPath.
309-
* <p>If the timeout is negative, not null, or greater than 2e16 - 1, an error code with
310-
* invalid argument will be returned.
311-
* @param time The amount of time to wait.
312-
* @param unit The unit of measure for {@code time}.
313-
* @return A self reference.
314-
*/
315-
@Deprecated
316-
Timeouts implicitlyWait(long time, TimeUnit unit);
317-
318298
/**
319299
* Specifies the amount of time the driver should wait when searching for an element if it is
320300
* not immediately present.
@@ -333,9 +313,7 @@ interface Timeouts {
333313
* @param duration The duration to wait.
334314
* @return A self reference.
335315
*/
336-
default Timeouts implicitlyWait(Duration duration) {
337-
return implicitlyWait(duration.toMillis(), TimeUnit.MILLISECONDS);
338-
}
316+
Timeouts implicitlyWait(Duration duration);
339317

340318
/**
341319
* Gets the amount of time the driver should wait when searching for an element if it is not

java/src/org/openqa/selenium/firefox/Executable.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@
2626
import org.openqa.selenium.WebDriverException;
2727
import org.openqa.selenium.internal.Require;
2828

29-
/** Wrapper around Firefox executable. */
29+
/**
30+
* Wrapper around Firefox executable.
31+
*
32+
* @deprecated Class {@link FirefoxBinary} will be removed in the future. Functionality of this
33+
* class is already covered by Selenium Manager.
34+
*/
35+
@Deprecated
3036
class Executable {
3137

3238
private final File binary;
@@ -57,6 +63,12 @@ public String getVersion() {
5763
return version;
5864
}
5965

66+
/**
67+
* @deprecated Use {@link FirefoxOptions#setBinary(Path)} or {@link
68+
* FirefoxOptions#setBinary(String)} instead. Class {@link Executable} will also be removed in
69+
* the future.
70+
*/
71+
@Deprecated
6072
public FirefoxBinary.Channel getChannel() {
6173
if (channel == null) {
6274
loadChannelPref();

java/src/org/openqa/selenium/firefox/FirefoxBinary.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
@Deprecated
4949
public class FirefoxBinary {
5050

51-
/** Enumerates Firefox channels, according to https://wiki.mozilla.org/RapidRelease */
51+
/**
52+
* Enumerates Firefox channels, according to <a
53+
* href="https://wiki.mozilla.org/RapidRelease">...</a>
54+
*/
5255
public enum Channel {
5356
ESR("esr"),
5457
RELEASE("release"),

java/src/org/openqa/selenium/firefox/FirefoxOptions.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,23 @@ public FirefoxOptions configureFromEnv() {
152152
/**
153153
* Constructs a {@link FirefoxBinary} and returns that to be used, and because of this is only
154154
* useful when actually starting firefox.
155+
*
156+
* @deprecated This method is deprecated and will be removed in a future version. Selenium Manager
157+
* handles this for you.
155158
*/
159+
@Deprecated
156160
public FirefoxBinary getBinary() {
157161
return getBinaryOrNull().orElseGet(FirefoxBinary::new);
158162
}
159163

164+
/**
165+
* Sets the path to the Firefox binary to use. This is useful when you have multiple versions of
166+
* Firefox installed on your machine.
167+
*
168+
* @deprecated This method is deprecated and will be removed in a future version. Use {@link
169+
* #setBinary(Path)} or {@link #setBinary(String)} instead.
170+
*/
171+
@Deprecated
160172
public FirefoxOptions setBinary(FirefoxBinary binary) {
161173
Require.nonNull("Binary", binary);
162174
addArguments(binary.getExtraOptions());
@@ -173,6 +185,14 @@ public FirefoxOptions setBinary(String path) {
173185
return setFirefoxOption(Keys.BINARY, path);
174186
}
175187

188+
/**
189+
* Returns the binary as a {@link FirefoxBinary} if it was set, or an empty {@link Optional} if
190+
* not.
191+
*
192+
* @deprecated This method is deprecated and will be removed in a future version. Selenium Manager
193+
* handles this for you.}
194+
*/
195+
@Deprecated
176196
public Optional<FirefoxBinary> getBinaryOrNull() {
177197
Object binary = firefoxOptions.get(Keys.BINARY.key());
178198
if (!(binary instanceof String)) {

java/src/org/openqa/selenium/ie/InternetExplorerDriver.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@ public class InternetExplorerDriver extends RemoteWebDriver {
3333
/** Capability that defines whether to ignore the browser zoom level or not. */
3434
public static final String IGNORE_ZOOM_SETTING = "ignoreZoomSetting";
3535

36-
/**
37-
* Capability that defines to use whether to use native or javascript events during operations.
38-
*
39-
* @deprecated Non W3C compliant
40-
*/
41-
@Deprecated public static final String NATIVE_EVENTS = "nativeEvents";
42-
4336
/** Capability that defines the initial URL to be used when IE is launched. */
4437
public static final String INITIAL_BROWSER_URL = "initialBrowserUrl";
4538

java/src/org/openqa/selenium/ie/InternetExplorerOptions.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import static org.openqa.selenium.ie.InternetExplorerDriver.IGNORE_ZOOM_SETTING;
2929
import static org.openqa.selenium.ie.InternetExplorerDriver.INITIAL_BROWSER_URL;
3030
import static org.openqa.selenium.ie.InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS;
31-
import static org.openqa.selenium.ie.InternetExplorerDriver.NATIVE_EVENTS;
3231
import static org.openqa.selenium.ie.InternetExplorerDriver.REQUIRE_WINDOW_FOCUS;
3332
import static org.openqa.selenium.remote.Browser.IE;
3433
import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;
@@ -85,7 +84,6 @@ public class InternetExplorerOptions extends AbstractDriverOptions<InternetExplo
8584
INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
8685
REQUIRE_WINDOW_FOCUS,
8786
UPLOAD_DIALOG_TIMEOUT,
88-
NATIVE_EVENTS,
8987
LEGACY_FILE_UPLOAD_DIALOG_HANDLING,
9088
ATTACH_TO_EDGE_CHROME,
9189
EDGE_EXECUTABLE_PATH,
@@ -202,16 +200,6 @@ public InternetExplorerOptions introduceFlakinessByIgnoringSecurityDomains() {
202200
return amend(INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
203201
}
204202

205-
/**
206-
* Method that defines to use whether to use native or javascript events during operations.
207-
*
208-
* @deprecated Non W3C compliant
209-
*/
210-
@Deprecated
211-
public InternetExplorerOptions disableNativeEvents() {
212-
return amend(NATIVE_EVENTS, false);
213-
}
214-
215203
public InternetExplorerOptions ignoreZoomSettings() {
216204
return amend(IGNORE_ZOOM_SETTING, true);
217205
}

java/src/org/openqa/selenium/remote/RemoteWebDriver.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -955,12 +955,6 @@ public Window window() {
955955

956956
protected class RemoteTimeouts implements Timeouts {
957957

958-
@Deprecated
959-
@Override
960-
public Timeouts implicitlyWait(long time, TimeUnit unit) {
961-
return implicitlyWait(Duration.ofMillis(unit.toMillis(time)));
962-
}
963-
964958
@Override
965959
public Timeouts implicitlyWait(Duration duration) {
966960
execute(DriverCommand.SET_IMPLICIT_WAIT_TIMEOUT(duration));

java/src/org/openqa/selenium/support/pagefactory/AjaxElementLocator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.lang.reflect.Field;
2121
import java.time.Clock;
22+
import java.time.Duration;
2223
import java.util.ArrayList;
2324
import java.util.List;
2425
import org.openqa.selenium.NoSuchElementException;
@@ -137,7 +138,7 @@ private class SlowLoadingElement extends SlowLoadableComponent<SlowLoadingElemen
137138
private WebElement element;
138139

139140
public SlowLoadingElement(Clock clock, int timeOutInSeconds) {
140-
super(clock, timeOutInSeconds);
141+
super(clock, Duration.ofSeconds(timeOutInSeconds));
141142
}
142143

143144
@Override
@@ -178,7 +179,7 @@ private class SlowLoadingElementList extends SlowLoadableComponent<SlowLoadingEl
178179
private List<WebElement> elements;
179180

180181
public SlowLoadingElementList(Clock clock, int timeOutInSeconds) {
181-
super(clock, timeOutInSeconds);
182+
super(clock, Duration.ofSeconds(timeOutInSeconds));
182183
}
183184

184185
@Override

java/src/org/openqa/selenium/support/ui/SlowLoadableComponent.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ public abstract class SlowLoadableComponent<T extends LoadableComponent<T>>
3838
private final Clock clock;
3939
private final Duration timeOut;
4040

41-
/**
42-
* @deprecated Use {@link #SlowLoadableComponent(Clock, Duration)} instead.
43-
*/
44-
@Deprecated
45-
public SlowLoadableComponent(Clock clock, int timeOutInSeconds) {
46-
this(clock, Duration.ofSeconds(timeOutInSeconds));
47-
}
48-
4941
public SlowLoadableComponent(Clock clock, Duration timeOut) {
5042
this.clock = clock;
5143
this.timeOut = timeOut;

java/test/org/openqa/selenium/firefox/FirefoxDriverTest.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@
2121
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
2222
import static org.junit.jupiter.api.Assertions.fail;
2323
import static org.junit.jupiter.api.Assumptions.assumeTrue;
24-
import static org.mockito.Mockito.atLeastOnce;
2524
import static org.mockito.Mockito.doThrow;
2625
import static org.mockito.Mockito.mock;
27-
import static org.mockito.Mockito.spy;
28-
import static org.mockito.Mockito.verify;
2926
import static org.openqa.selenium.WaitingConditions.elementValueToEqual;
3027
import static org.openqa.selenium.firefox.FirefoxAssumptions.assumeDefaultBrowserLocationUsed;
3128
import static org.openqa.selenium.remote.CapabilityType.ACCEPT_INSECURE_CERTS;
@@ -43,7 +40,6 @@
4340
import org.mockito.ArgumentMatchers;
4441
import org.openqa.selenium.By;
4542
import org.openqa.selenium.Capabilities;
46-
import org.openqa.selenium.Dimension;
4743
import org.openqa.selenium.HasCapabilities;
4844
import org.openqa.selenium.ImmutableCapabilities;
4945
import org.openqa.selenium.JavascriptExecutor;
@@ -96,17 +92,6 @@ public void canStartDriverWithNoParameters() {
9692
.isEqualTo("firefox");
9793
}
9894

99-
@Test
100-
@NoDriverBeforeTest
101-
public void canStartDriverWithSpecifiedBinary() {
102-
FirefoxBinary binary = spy(new FirefoxBinary());
103-
FirefoxOptions options = new FirefoxOptions().setBinary(binary);
104-
105-
localDriver = new WebDriverBuilder().get(options);
106-
107-
verify(binary, atLeastOnce()).getPath();
108-
}
109-
11095
@Test
11196
void shouldGetMeaningfulExceptionOnBrowserDeath() throws Exception {
11297
RemoteWebDriver driver2 = (RemoteWebDriver) new WebDriverBuilder().get();
@@ -175,20 +160,6 @@ public void shouldBeAbleToStartANewInstanceEvenWithVerboseLogging() {
175160
new FirefoxDriver(service, (FirefoxOptions) FIREFOX.getCapabilities()).quit();
176161
}
177162

178-
@Test
179-
@NoDriverBeforeTest
180-
public void shouldBeAbleToPassCommandLineOptions() {
181-
FirefoxBinary binary = new FirefoxBinary();
182-
binary.addCommandLineOptions("-width", "800", "-height", "600");
183-
184-
localDriver = new WebDriverBuilder().get(new FirefoxOptions().setBinary(binary));
185-
Dimension size = localDriver.manage().window().getSize();
186-
assertThat(size.width).isGreaterThanOrEqualTo(800);
187-
assertThat(size.width).isLessThan(850);
188-
assertThat(size.height).isGreaterThanOrEqualTo(600);
189-
assertThat(size.height).isLessThan(650);
190-
}
191-
192163
@Test
193164
@NoDriverBeforeTest
194165
public void canPassCapabilities() {

0 commit comments

Comments
 (0)