0
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.proxy import *
import time
myProxy = "xxx.x.x:yyy"
proxy = Proxy({
'proxyType': ProxyType.MANUAL,
'httpProxy': myProxy,
'ftpProxy': myProxy,
'sslProxy': myProxy,
'noProxy': '' # set this value as desired
})
driver = webdriver.Firefox(proxy=proxy)
###
alert = driver.switch_to_alert()
time.sleep(1)
ActionChains(driver).send_keys('xxxxx')
ActionChains(driver).send_keys(Keys.TAB).perform()
ActionChains(driver).send_keys('yyyy')
alert.accept()
該對話框出現並彈出,但項目只是掛起,不會輸入任何鍵。我如何填寫對話框字段?Python - 爲什麼不是這個硒警報,發送鍵,工作?