-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
46 lines (37 loc) · 1.04 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from time import sleep
from selenium import webdriver
PROXY = '91.214.31.234:8080'
# Firefox Proxy
def firefox_proxy():
webdriver.DesiredCapabilities.FIREFOX['proxy'] = {
"httpProxy": PROXY,
"sslProxy": PROXY,
"proxyType": "MANUAL",
}
driver = webdriver.Firefox()
driver.get("https://www.icanhazip.com")
sleep(5)
driver.quit()
# Method 1 for Chrome Proxy
def chrome_proxy_1():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)
driver = webdriver.Chrome(options=chrome_options)
driver.get("https://www.icanhazip.com")
sleep(5)
driver.quit()
# Method 2 for Chrome Proxy
def chrome_proxy_2():
webdriver.DesiredCapabilities.CHROME['proxy'] = {
"httpProxy": PROXY,
"sslProxy": PROXY,
"proxyType": "MANUAL",
}
driver = webdriver.Chrome()
driver.get("https://www.icanhazip.com")
sleep(5)
driver.quit()
if __name__ == '__main__':
firefox_proxy()
chrome_proxy_1()
chrome_proxy_2()