我正在嘗試打開一個看起來像這樣的鏈接
我正在使用 Selenium、Python 并在配置驅動器后嘗試使用以下結構打開鏈接:
https://username:[email protected]/otcs/llisapi.dll?func=ll&objId=120499404&objAction=browse&viewType=1
但它不起作用。
我將不勝感激任何建議,謝謝。
uj5u.com熱心網友回復:
var alert = driver.SwitchTo().Alert()
alert.SetAuthenticationCredentials("username", "password")
alert.Accept()
uj5u.com熱心網友回復:
當彈出一個新視窗時,您必須在 Selenium 中處理它。
web = webdriver.Firefox()
web.get('URL OF PAGE')
# DEFINE MAIN PAGE WINDOW:
main_page = web.current_window_handle
#SWITCH WINDOW TO NEW POPUP PAGE
for handle in web.window_handles:
if handle != main_page:
popup_page = handle
web.switch_to.window(popup_page)
請參閱:https ://selenium-python.readthedocs.io/navigating.html
然后你可以使用 Selenium 來send_keys("Username")
舉例send_keys("Password")
。
根據:https ://selenium-python.readthedocs.io/api.html
uj5u.com熱心網友回復:
謝謝你們的幫助!決定只是嘗試切換驅動程式,從 Firefox 到 Edge,它解決了所有問題
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/506926.html