gpt4 book ai didi

python Selenium : How to let human interaction in a automated script?

转载 作者:太空宇宙 更新时间:2023-11-04 05:32:19 25 4
gpt4 key购买 nike

我正在编写一个在弹出窗口中显示验证码和其他一些内容的脚本。我正在为 FireFox 编写脚本。是否有可能我提供这些值并点击提交按钮脚本可以恢复操作?我猜,某种无限循环?

最佳答案

您可以等待用户点击提交按钮:

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# load the page
driver.get("https://www.google.com/recaptcha/api2/demo")

# get the submit button
bt_submit = driver.find_element_by_css_selector("[type=submit]")

# wait for the user to click the submit button (check every 1s with a 1000s timeout)
WebDriverWait(driver, timeout=1000, poll_frequency=1) \
.until(EC.staleness_of(bt_submit))

print "submitted"

关于 python Selenium : How to let human interaction in a automated script?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36725973/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com