第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何使用 Python 在 Selenium 中使用用戶名和密碼對(duì)代理進(jìn)行身份驗(yàn)證

如何使用 Python 在 Selenium 中使用用戶名和密碼對(duì)代理進(jìn)行身份驗(yàn)證

慕村225694 2023-08-03 17:23:12
我正在嘗試使用 Python 在 Selenium 中使用用戶名和密碼對(duì)代理進(jìn)行身份驗(yàn)證,但當(dāng)前代碼不起作用。我嘗試了很多解決方案,但沒有一個(gè)有效。代理示例,IP = xxx.xx.xx.xxPORT = xxxxxUSERNAME = USERNAMEPASSWORD = PASSWORD我使用了以下代碼,driver.execute_script("""          Services.prefs.setIntPref('network.proxy.type', 1);          Services.prefs.setCharPref("network.proxy.http", arguments[0]);          Services.prefs.setIntPref("network.proxy.http_port", arguments[1]);          Services.prefs.setCharPref("network.proxy.ssl", arguments[0]);          Services.prefs.setIntPref("network.proxy.ssl_port", arguments[1]);          Services.prefs.setCharPref('network.proxy.socks', arguments[4]);          Services.prefs.setIntPref('network.proxy.socks_port', arguments[5]);          Services.prefs.setCharPref('network.proxy.socks_username', arguments[6]);          Services.prefs.setCharPref('network.proxy.socks_password', arguments[7]);          """, http_addr, http_port, ssl_addr, ssl_port, socks_addr, socks_port, socks_username, socks_password)我也嘗試過其他一些代碼片段。我也嘗試將值放入警報(bào)框中。
查看完整描述

1 回答

?
繁華開滿天機(jī)

TA貢獻(xiàn)1816條經(jīng)驗(yàn) 獲得超4個(gè)贊

您可以使用AutoIt來實(shí)現(xiàn)此目的。它具有 Python 綁定PyAutoIt。使用 PIP 安裝 PyAutoIt 后pip install PyAutoIt,以下代碼即可完成您的工作。

import autoit


autoit.win_wait_active("Authentication Required") # title of the dialog box to wait. so it will wait for the Authentication Required dialog

autoit.send("username", 1) # second parameter is the mode (changes how "keys" is processed)

autoit.send("{TAB}") # press tab key to go to the password field

autoit.send("password", 1)

autoit.send("{Enter}") # press enter key

有關(guān) send 方法中第二個(gè)參數(shù)的更多信息,這里是代碼,


def send(send_text, mode=0):

? ? """

? ? Sends simulated keystrokes to the active window.

? ? :param send_text:

? ? :param mode: Changes how "keys" is processed:

? ? ? ? flag = 0 (default), Text contains special characters like + and ! to

? ? ? ? ?indicate SHIFT and ALT key presses.

? ? ? ? flag = 1, keys are sent raw.

? ? :return:

? ? """

? ? AUTO_IT.AU3_Send(LPCWSTR(send_text), INT(mode))


查看完整回答
反對(duì) 回復(fù) 2023-08-03
  • 1 回答
  • 0 關(guān)注
  • 178 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)