-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[NODRIVER] NameError: name 'items' is not defined in async select method #2122
Comments
Hey @khamaileon, I created a fork of nodriver here stephanlensky/zendriver which fixes this and other bugs, feel free to take a look. |
I can confirm that the problem is resolved with Zendriver. |
You can find a fix to that and other Includes a Here's a sample script that scrapes the Nike website for shoe prices: from seleniumbase import SB
with SB(uc=True, test=True, locale_code="en", ad_block=True) as sb:
url = "https://www.nike.com/"
sb.activate_cdp_mode(url)
sb.sleep(2.5)
sb.cdp.gui_click_element('div[data-testid="user-tools-container"]')
sb.sleep(1.5)
search = "Nike Air Force 1"
sb.cdp.press_keys('input[type="search"]', search)
sb.sleep(4)
elements = sb.cdp.select_all('ul[data-testid*="products"] figure .details')
if elements:
print('**** Found results for "%s": ****' % search)
for element in elements:
print("* " + element.text)
sb.sleep(2) Or if you prefer import asyncio
import time
from seleniumbase.undetected import cdp_driver
async def main():
driver = await cdp_driver.cdp_util.start_async()
page = await driver.get("https://www.priceline.com/")
time.sleep(3)
print(await page.evaluate("document.title"))
element = await page.select('[data-testid*="endLocation"]')
await element.click_async()
time.sleep(1)
await element.send_keys_async("Boston")
time.sleep(2)
if __name__ == "__main__":
loop = asyncio.new_event_loop()
loop.run_until_complete(main()) |
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: