Skip to content

Commit

Permalink
Close trio memory channel sender after the driver is quit (#13151)
Browse files Browse the repository at this point in the history
* fix typing bug

* fix: #13147

---------

Co-authored-by: Titus Fortner <[email protected]>
  • Loading branch information
jnhyperion and titusfortner authored Nov 27, 2023
1 parent 6d7139d commit 2008e10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions py/selenium/webdriver/common/bidi/cdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,11 @@ async def _reader_task(self):
else:
self._handle_data(data)

for _, session in self.sessions.items():
for _, senders in session.channels.items():
for sender in senders:
sender.close()


@asynccontextmanager
async def open_cdp(url) -> typing.AsyncIterator[CdpConnection]:
Expand Down
3 changes: 2 additions & 1 deletion py/selenium/webdriver/remote/webelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from base64 import encodebytes
from hashlib import md5 as md5_hash
from io import BytesIO
from typing import List

from selenium.common.exceptions import JavascriptException
from selenium.common.exceptions import WebDriverException
Expand Down Expand Up @@ -415,7 +416,7 @@ def find_element(self, by=By.ID, value=None) -> WebElement:

return self._execute(Command.FIND_CHILD_ELEMENT, {"using": by, "value": value})["value"]

def find_elements(self, by=By.ID, value=None) -> list[WebElement]:
def find_elements(self, by=By.ID, value=None) -> List[WebElement]:
"""Find elements given a By strategy and locator.
:Usage:
Expand Down

0 comments on commit 2008e10

Please sign in to comment.