botasaurus
botasaurus copied to clipboard
Cannot type in parrallel browser due to browser overlap each other
@browser(run_async=True) def google_search_and_click_sequential(driver: Driver, data=None): query = "httpbin ip httpbin org"
driver.enable_human_mode()
driver.get(data)
el = driver._tab.wait_for('textarea[name="q"]', timeout=40)
el.send_keys(query, press_enter=True)
mouseClick(driver)
time.sleep(2)
driver.wait_for_element("a h3", wait=20)
first_result = driver.select_all("a h3")[0]
first_result.click()
driver.short_random_sleep()
filename = f"screenshot_{uuid.uuid4().hex}.png"
driver.save_screenshot(filename)
return {"screenshot": filename}
URLs to process
urls = [ "https://www.google.com/", "https://www.google.com/", "https://www.google.com/" ]