-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_proxy_in_selenium.py
More file actions
30 lines (25 loc) · 893 Bytes
/
Copy pathtest_proxy_in_selenium.py
File metadata and controls
30 lines (25 loc) · 893 Bytes
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
from selenium import webdriver
driver_path="Driver_path"
PROXY="Type_proxy"
chrome_option = webdriver.ChromeOptions()
chrome_option.add_argument("--disable-notifications")
chrome_option.add_argument('--headless')
chrome_option.add_argument('--proxy-server=%s' % PROXY)
chrome_option.add_argument("--incognito")
chrome_option.add_argument("--start-maximized")
connection_attempt=0
while True:
connection=0
connection_attempt=connection_attempt+1
try:
driver = webdriver.Chrome(executable_path= driver_path,chrome_options=chrome_option)
driver.maximize_window()
br=1
connection=1
print("\n Connection successfull")
except Exception as e:
print(e)
driver_path=input("\n Enter the Compatible chrome driver path")
if connection==1 or connection_attempt > 5:
break
driver.get("https://www.linkedin.com/login")