-
-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathproxy_with_auth.py
More file actions
22 lines (14 loc) · 639 Bytes
/
proxy_with_auth.py
File metadata and controls
22 lines (14 loc) · 639 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from selenium_driverless import webdriver
import asyncio
async def main():
# socks5 with credentials not supported due to https://bugs.chromium.org/p/chromium/issues/detail?id=1309413
proxy = "http://user1:passwrd1@example.proxy.com:5001/"
options = webdriver.ChromeOptions()
# options.single_proxy = proxy
async with webdriver.Chrome(options=options) as driver:
# this will overwrite the proxy for ALL CONTEXTS
await driver.set_single_proxy(proxy)
await driver.get("https://browserleaks.com/webrtc")
await driver.clear_proxy() # clear proxy
print()
asyncio.run(main())