SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
29.78k stars 8.02k forks source link

[🐛 Bug]: `chrome`/`chromium` type break as of `@types/selenium-webdriver@4.1.23` #14068

Closed Zidious closed 1 month ago

Zidious commented 1 month ago

What happened?

As of updating to use the @latest release of the @types/selenium-webdriver package 4.1.23. This appears to have introduced a type break. This issue doesn't appear on 4.1.22

Just curious if this was an intentional change?

How can we reproduce the issue?

import webdriver from "selenium-webdriver";
import { Options } from "selenium-webdriver/chrome";

(async () => {
  const driver = await new webdriver.Builder()
    .forBrowser("chrome")
    .setChromeOptions(new Options().addArguments("--headless"))
    .build();

  await driver.get("https://www.google.com");
  //...
  await driver.quit();
})();

Relevant log output

sandbox.ts:7:23 - error TS2345: Argument of type 'import("/Users/XXX/sandbox/node_modules/@types/selenium-webdriver/chromium").Options' is not assignable to parameter of type 'import("/Users/XXX/sandbox/node_modules/@types/selenium-webdriver/chrome").Options'.
  Type 'Options' is missing the following properties from type 'Options': setChromeBinaryPath, androidChrome, setChromeLogFile, setChromeMinidumpPath

7     .setChromeOptions(new Options().addArguments("--headless"))

Specifically:

Type 'Options' is missing the following properties from type 'Options': setChromeBinaryPath, androidChrome, setChromeLogFile, setChromeMinidumpPathts(2345)

Operating System

macOS Sonoma 14.4.1

Selenium version

4.21.0

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?

124

Are you using Selenium Grid?

No response

github-actions[bot] commented 1 month ago

@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, MSEdgeDriver, 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!

titusfortner commented 1 month ago

For good or bad, we don't maintain the type definitions in this project. You'll want to discuss on DefinitelyTyped repo

github-actions[bot] commented 2 days ago

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.