- Overwrite device metrics using Selenium
- Mobile and Desktop emulation
- Undetected by Google, Cloudflare, ..
- Modifying or adding headers supported using "ModHeader" chrome-extension
- Python >= 3.7
- Windows or Google-Colab (Linux not tested yet)
- Chrome-Browser installed
- selenium-profiles
- [Windows] Install Chrome-Browser
pip install selenium-profiles
from selenium_profiles.driver import driver as mydriver
from selenium_profiles.profiles import profiles
from selenium.webdriver.common.by import By # locate elements
mydriver = mydriver()
driver = mydriver.start(profiles.Windows(), uc_driver=False) # or .Android
# get url
driver.get('https://browserleaks.com/client-hints') # test client hints
input("Press ENTER to exit: ")
driver.quit() # Execute on the End!
Don't forget to execute
driver.quit()
in the End. Else-wise your temporary folder will get flooded! (Windows)
Google-Colab (file: google-colab/selenium_profiles.ipynb)
Example Profile:
{
"device":{
"mobile": false,
"model": "modelName",
"language": "de-CH,de;q=0.9",
"touch_device": true,
"maxtouchpoints": 5,
"hardware_accel": false,
"emulation": {"width": 384, "height": 700, "deviceScaleFactor": 10,
"screenOrientation": {"type": "portraitPrimary", "angle": 0}},
"agent_override": {
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36",
"userAgentMetadata": {
"brands": [{"brand":"Google Chrome","version":"107"},
{"brand":"Chromium","version":"107"},
{"brand":"Not=A?Brand","version":"24"}],
"fullVersionList": [{"brand":"Google Chrome","version":"107.0.5304.88"},
{"brand":"Chromium","version":"107.0.5304.88"},
{"brand":"Not=A?Brand","version":"24.0.0.0"}],
"fullVersion": "107.0.5304.88",
"platform": "Windows",
"platformVersion": "10.0.0",
"architecture": "x86",
"model": "modelName",
"mobile": true,
"bitness": "64",
"wow64": false}
}},
"browser": {
"sandbox": true, "inkognito": true,"headless":false, "proxy": null, "darkmode": true,
"pointer_as_touch": false, "mobile_view": false, "app": false, "touch_events": true,
"window_size": {"x": 400, "y": 400}
},
"chromeoptions": {"arguments": ["--my-argument=value", ".."], "capabilities": [["cap_name", "cap_value"], ".."]},
"cdp_cmd": [["name", "value"], ".."],
"evaluate_on_new_document": "my_js_script",
"plugins": {
"selenium-wire": false,
"modheader":"[{\"headers\":[{\"enabled\":true,\"name\":\"google\",\"value\":\"\\\"x\\\"\"}],\"shortTitle\":\"1\",\"title\":\"Profile 1\",\"version\":2}]",
"stealth": false,
"buster": false
}
}
go to https://jsconsole.com/ in your browser and copy the text.
and then run in Python:
from selenium_profiles.scripts.profiles import navigator2profile
myprofile = navigator2profile("my_copied_text", filename='myprofile.json')
Please feel free to open an issue or fork!
- click_as_touch makes automation hung
- Undetected
- support custom device metrics
- export browser profile
- Add License
- installer.py script
- buster captcha solver | wontfix
- modheader
- chromedriver
- Windows
- Jupyter (Google-Colab)
- Linux (not tested yet!)
- Chrome-Browsers
- requirements.txt
- Selenium-Devices as installable module
- implement headless javascript headless
- Mobile emulation
- click_as touch makes code hung
- default metrics
- Android
- Windows
- IOS
- Linux
- Tablet
- change metrics while running
- disable emulation while running
- test.py script
- test_driver.py
- useragent, profile_export (no error)
- Windows
- Android
- useragent, profile_export (no error)
- test_driver.py
- plugins support
- selenium-wire
- modheader
- load modheader profile
- add headers without profile
- stealth
- audio_captcha_solver
- Rewrite driver.py to V2.2
- support for
- Windows
- Jupyter Notebook (Google-Colab)
- Linux
- Stealth method (Detected by Google)
- Selenium-Wire (proxy, no https)
- buster captcha solver | wontfix
- Undetected-Chromedriver (Selenium-Webdriver should be used directly)
- patched_driverV1
- first version as importable file
- sel_profilesV2
- added custom device metrics
- added default.json metrics
- Android
- Windows
- added navigator2profile, driver.get_profile()
- added modheader (load modheader json profile)
- put everything into folders
- googleV1 (not released yet!)
- first version as importable file
- selenium-profilesV2.2
- installable as module (pip) *selenium-profiles V2.2.4 (pre-release, unstable!)
- removed undetected-chromedriver dependency
- moved parts of driver to
selenium_profiles/scripts
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
I am not responsible what you use the code for!!! Also no warranty!
Inspiration, code snippets, etc.
- Selenium
- selenium-documentation
- README-Template
- headless_js
- Selenium-Stealth
- Undetected-Chromedriver
- Selenium-Wire
- Modheader-Selenium
- ModHeader docs
- buster captcha solver | wontfix
- audio_captcha_solver
- Chromedriver-Options List
- Chrome DevTools Protocol (cdp_cmd)
- example_pypi_package
- google-colab installer
- scripts/touch_action_chain