You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
When using the select method, a NameError is raised:
NameError: name 'items' is not defined. Did you mean: 'item'?
asyncdefselect(
self,
selector: str,
timeout: Union[int, float] =10,
) ->nodriver.Element:
""" find single element by css selector. can also be used to wait for such element to appear. :param selector: css selector, eg a[href], button[class*=close], a > img[src] :type selector: str :param timeout: raise timeout exception when after this many seconds nothing is found. :type timeout: float,int """loop=asyncio.get_running_loop()
start_time=loop.time()
selector=selector.strip()
item=awaitself.query_selector(selector)
whilenotitem:
awaitselfitem=awaitself.query_selector(selector)
ifloop.time() -start_time>timeout:
returnitemsawaitself.sleep(0.5)
returnitem
Steps to Reproduce:
Call the select method with a CSS selector and a timeout value.
Ensure that no matching element appears within the timeout period.
Observe the NameError when the return items line is executed.
Expected Behavior:
The method should raise an appropriate exception if no matching element is found within the timeout period.
Actual Behavior:
The method raises a NameError because the variable items is not defined.
The text was updated successfully, but these errors were encountered:
khamaileon
changed the title
NameError: name 'items' is not defined in async select method
[NODRIVER] NameError: name 'items' is not defined in async select method
Jan 25, 2025
Description:
When using the
select
method, aNameError
is raised:Steps to Reproduce:
select
method with a CSS selector and a timeout value.NameError
when thereturn items
line is executed.Expected Behavior:
The method should raise an appropriate exception if no matching element is found within the timeout period.
Actual Behavior:
The method raises a
NameError
because the variableitems
is not defined.The text was updated successfully, but these errors were encountered: