-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
39 lines (32 loc) · 1.25 KB
/
test.py
File metadata and controls
39 lines (32 loc) · 1.25 KB
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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
from src.bot import config
def check_selenium_linkedin():
"""
Check if Selenium can connect to LinkedIn and verify login status.
Returns True if login is successful, False otherwise.
"""
print("Testing Selenium connection to LinkedIn...")
options = Options()
options.add_argument("--window-size=900,600")
options.add_argument("--ignore-certificate-errors")
options.add_argument('--no-sandbox')
options.add_argument("--disable-blink-features=AutomationControlled")
try:
driver = webdriver.Chrome(options=options)
driver.get('https://www.linkedin.com/login')
# Check if the login page loaded
if "LinkedIn Login" not in driver.title:
print("❌ Could not load LinkedIn login page")
driver.quit()
return False
print("✅ Successfully connected to LinkedIn")
driver.quit()
return True
except Exception as e:
print(f"❌ Error connecting to LinkedIn: {str(e)}")
return False
if __name__ == "__main__":
# Test the function when this file is run directly
check_selenium_linkedin()