-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: remove duplicated keyword argument timeout
#1870
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
Conversation
```shell RuntimeWarning: coroutine 'PlaywrightContextManager.__aexit__' was never awaited playwright.stop() ```
TypeError: screenshot() got multiple values for keyword argument 'timeout'
playwright/_impl/_locator.py
Outdated
@@ -517,6 +517,7 @@ async def screenshot( | |||
mask: List["Locator"] = None, | |||
) -> bytes: | |||
params = locals_to_params(locals()) | |||
del params["timeout"] | |||
return await self._with_element( | |||
lambda h, timeout: h.screenshot(timeout=timeout, **params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lambda h, timeout: h.screenshot(timeout=timeout, **params) | |
lambda h, timeout: h.screenshot(**params) |
do you mind adding a test for it? I think also this is a cleaner bugfix.
Hi @mxschmitt, Sure. I can add the test. But I have one question about your solution:
async def select_text(self, force: bool = None, timeout: float = None) -> None:
# [m-arg]
params = locals_to_params(locals())
del params["timeout"] # [PR]
return await self._with_element(
lambda h, timeout: h.select_text(timeout=timeout, **params), timeout
# [f-arg] [f-arg?] [PR] [m-arg?]
)
# m-arg -> method arg
# f-arg -> lambda function arg |
You are right, I didn't realise that. It should receive of course the lambda timeout. I think my favourite fix would be: |
Cool! I think dict unpacking style is better than using the |
|
Thanks! |
Traceback:
I fix this problem with the coding style:
playwright-python/playwright/_impl/_locator.py
Lines 395 to 400 in 47caa7c