[🐛 Bug]: WebdriverJS FluentWait
What happened?
WebdriverJS FluentWait works in Javascript as per the example in the documentation. However in TypeScript we are missing the types for the 4th parameter (the frequency at which it polls).
Working JavaScript example (which is polling and including the frequency at which it polls:
const { Builder } = require("selenium-webdriver");
function myFunc() {
console.log("hello world");
}
(async function example() {
let driver = await new Builder().forBrowser("chrome").build();
await driver.get("http://google.com");
// should log 5 times, polling every 1 second then times out
await driver.wait(myFunc, 5000, "Timed out after 5 seconds", 1000);
await driver.close();
})();
How can we reproduce the issue?
import { Builder } from "selenium-webdriver";
function myFunc() {
console.log("hello world");
}
(async function example() {
let driver = await new Builder().forBrowser("chrome").build();
await driver.get("http://google.com");
// should log 5 times, polling every 1 second then times out
await driver.wait(myFunc, 5000, "Timed out after 5 seconds", 1000);
await driver.close();
})();
Note: if we cast the driver to any we are able to get it polling correctly:
await (driver as any).wait(myFunc, 5000, "Timed out after 5 seconds", 1000);
Relevant log output
index.ts:11:65 - error TS2554: Expected 1-3 arguments, but got 4.
11 await driver.wait(myFunc, 5000, "Timed out after 5 seconds", 1000);
Issue is within types.d.ts:
wait(condition: WebElementCondition, opt_timeout?: number, opt_message?: string): WebElementPromise;
Operating System
macOS
Selenium version
4.1.1
What are the browser(s) and version(s) where you see this issue?
Chrome
What are the browser driver(s) and version(s) where you see this issue?
97
Are you using Selenium Grid?
No response
@Zidious, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template label.
If the issue is a question, add the I-question label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, W3C),
add the applicable G-* label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer label.
Thank you!
The linked PR to DefinitelyTyped was merged, so this should be fine already. Closing.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.