Proper usage of input entry in cdp mode, get_driver, and switching between cdp and driver by reconnecting #4194
-
|
Recent proxies with authentication led me to try seleniumbase as default option but I couldn't manage properly using it in cdp mode or with combination of modes. Note: Should be in no with context usage. For the above basic instance, I can't send an Enter to the Google search input box after entering text. When I tried below, also didn't work and I get exception. Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Looks like you're trying to do a Google search. There's an example of that here: from seleniumbase import SB
with SB(uc=True, test=True) as sb:
url = "https://google.com/ncr"
sb.activate_cdp_mode(url)
sb.type('[title="Search"]', "SeleniumBase GitHub page")
sb.click("div:not([jsname]) > * > input")
sb.sleep(2)
print(sb.get_page_title())
sb.sleep(1) # Wait for the "AI Overview" result
if sb.is_text_visible("Generating"):
sb.wait_for_text("AI Overview")
sb.save_as_pdf_to_logs() # Saved to ./latest_logs/
sb.save_page_source_to_logs()
sb.save_screenshot_to_logs() |
Beta Was this translation helpful? Give feedback.
Looks like you're trying to do a Google search. There's an example of that here:
https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_google.py