Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to set DefaultNavigationTimeout via Timeouts.pageLoadTimeout #105

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/main/java/org/brit/driver/PlaywrightiumDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,16 @@ public PlaywrightWebdriverTimeouts() {

@Override
public Timeouts implicitlyWait(long time, TimeUnit unit) {
page.setDefaultTimeout(Duration.of(time, unit.toChronoUnit()).toMillis());
long millis = Duration.of(time, unit.toChronoUnit()).toMillis();
page.setDefaultTimeout(millis);
page.context().setDefaultTimeout(millis);
return this;
}

@Override
public Timeouts implicitlyWait(Duration duration) {
page.setDefaultTimeout(duration.toMillis());
page.context().setDefaultTimeout(duration.toMillis());
return this;
}

Expand Down Expand Up @@ -686,12 +689,17 @@ public Duration getScriptTimeout() {

@Override
public Timeouts pageLoadTimeout(long time, TimeUnit unit) {
return null;
long millis = Duration.of(time, unit.toChronoUnit()).toMillis();
page.setDefaultNavigationTimeout(millis);
page.context().setDefaultNavigationTimeout(millis);
return this;
}

@Override
public Timeouts pageLoadTimeout(Duration duration) {
return Timeouts.super.pageLoadTimeout(duration);
page.setDefaultNavigationTimeout(duration.toMillis());
page.context().setDefaultNavigationTimeout(duration.toMillis());
return this;
}

@Override
Expand Down
Loading