-
Hi All, Question to the scraping geeks. If anybody is unaware, below is the error you get when trying to activate CDP mode within Scrapy script
Many thanks for considering my request. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you're looking to use 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("about:blank")
await page.set_locale("en")
await page.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()) Otherwise, if you want nested event loops, see https://stackoverflow.com/a/61847103/7058266, which tells you to use import nest_asyncio
nest_asyncio.apply() |
Beta Was this translation helpful? Give feedback.
If you're looking to use
async
/await
with SeleniumBase CDP Mode, there's an async format. Eg: