-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed as not planned
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!C-pyPython BindingsPython BindingsR-help wantedIssues looking for contributionsIssues looking for contributions
Description
What happened?
When checking types with mypy v1.8.0, incompatible types are detected
url_to_be is declared as
def url_to_be(url: str) -> Callable[[WebDriver], bool]:
but any_of requires other argument type
def any_of(*expected_conditions: Callable[[D], T]) -> Callable[[D], Union[Literal[False], T]]:
How can we reproduce the issue?
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
self.__waiter: WebDriverWait
self.__data_url: str
elements = self.__waiter.until(
EC.any_of(
EC.visibility_of_any_elements_located((
By.CSS_SELECTOR,
"p.3yeW3"
)),
# mypy error: Argument 2 to "any_of" has incompatible type
# "Callable[[WebDriver], bool]";
# expected "Callable[[Any], Literal[False] | list[WebElement] | WebElement]"
EC.url_to_be(self.__data_url)
)
)Relevant log output
error: Argument 2 to "any_of" has incompatible type "Callable[[WebDriver], bool]"; expected "Callable[[Any], Literal[False] | list[WebElement] | WebElement]" [arg-type]Operating System
Ubuntu
Selenium version
4.17.2
What are the browser(s) and version(s) where you see this issue?
does not matter
What are the browser driver(s) and version(s) where you see this issue?
does not matter
Are you using Selenium Grid?
No response
Metadata
Metadata
Assignees
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!C-pyPython BindingsPython BindingsR-help wantedIssues looking for contributionsIssues looking for contributions