MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / select_all

Method select_all

seleniumbase/undetected/cdp_driver/tab.py:286–322  ·  view source on GitHub ↗

Find multiple elements by CSS Selector. Can also be used to wait for such elements to appear. :param selector: css selector, eg a[href], button[class*=close], a > img[src] :type selector: str :param timeout: Raise timeout exception wh

(
        self,
        selector: str,
        timeout: Union[int, float] = 10,
        include_frames=False,
    )

Source from the content-addressed store, hash-verified

284 return items
285
286 async def select_all(
287 self,
288 selector: str,
289 timeout: Union[int, float] = 10,
290 include_frames=False,
291 ) -> List[element.Element]:
292 """
293 Find multiple elements by CSS Selector.
294 Can also be used to wait for such elements to appear.
295 :param selector: css selector,
296 eg a[href], button[class*=close], a > img[src]
297 :type selector: str
298 :param timeout:
299 Raise timeout exception when after this many seconds nothing is found.
300 :type timeout: float,int
301 :param include_frames: Whether to include results in iframes.
302 :type include_frames: bool
303 """
304 loop = asyncio.get_running_loop()
305 now = loop.time()
306 selector = selector.strip()
307 items = []
308 if include_frames:
309 frames = await self.query_selector_all("iframe")
310 # Unfortunately, asyncio.gather is not an option here
311 for fr in frames:
312 items.extend(await fr.query_selector_all(selector))
313 items.extend(await self.query_selector_all(selector))
314 while not items:
315 await self
316 items = await self.query_selector_all(selector)
317 if loop.time() - now > timeout:
318 raise asyncio.TimeoutError(
319 "Time ran out while waiting for: {%s}" % selector
320 )
321 await self.sleep(0.5)
322 return items
323
324 async def get(
325 self,

Callers

nothing calls this directly

Calls 2

query_selector_allMethod · 0.95
sleepMethod · 0.45

Tested by

no test coverage detected