Skip to content

How i can evaluate an ASYNC script in cdp mode? #3553

Answered by mdmintz
jvitormelo asked this question in Q&A
Discussion options

You must be logged in to vote

See the async example for utilizing await: SeleniumBase/examples/cdp_mode/raw_async.py:

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/")


You have to stay in the same tab for CDP Mode.
If you want to switch between tabs, you have to reconnect the driver with sb.connect() first.
Here are a few examples that mix CDP Mode with WebDriver to do that:

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants