-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathone-time-use-profile.py
More file actions
42 lines (30 loc) · 1.02 KB
/
one-time-use-profile.py
File metadata and controls
42 lines (30 loc) · 1.02 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
40
41
42
import time
from gologin import GoLogin
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
# Initialize GoLogin
gl = GoLogin({
"token": "your dev token",
})
profile = gl.createProfileRandomFingerprint({ "os": "win" })
profile_id = profile.get('id')
gl.setProfileId(profile_id)
# Add proxy to the profile
gl.addGologinProxyToProfile(profile_id, "us")
# Start Browser and get websocket url
debugger_address = gl.start()
# Get Chromium version for webdriver
chromium_version = gl.get_chromium_version()
# Install webdriver
service = Service(ChromeDriverManager(driver_version=chromium_version).install())
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("debuggerAddress", debugger_address)
driver = webdriver.Chrome(service=service, options=chrome_options)
# Give command to Selenium to open the page
driver.get("http://www.python.org")
time.sleep(30)
driver.quit()
time.sleep(10)
gl.delete(profile_id)
gl.stop()