簡體   English   中英

使用 selenium (Python) 打開 Chrome 后立即關閉

[英]Chrome closes immediately after being opened with selenium (Python)

我已經嘗試了我能找到的所有解決方案。

我正在嘗試使用 selenium 打開 Chrome 以進行 Imgur 身份驗證。 這是代碼:

def imgur_auth():
     imgur_id = 'NO'
     imgur_secret = 'NO'
     client = ImgurClient(imgur_id, imgur_secret)
     imgur_name = 'NO'
     imgur_password = 'NO'
     imgur_auth_url = client.get_auth_url('pin')
     driver = webdriver.Chrome(executable_path=r'NO\Python\other\chromedriver')
     driver.get(imgur_auth_url)

imgur_auth()

Chrome 打開並加載頁面后,它會立即關閉。

幫助?

當您在 function 中調用驅動程序 var 時,它在 function 執行后終止。

嘗試刪除 function 並運行

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM