Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##########################--BEFORE INSTALL--###################################################
- # wget https://github.com/aghorler/WebRTC-Leak-Prevent/archive/master.zip #webrtc block extention
- # unzip master.zip
- # cd WebRTC-Leak-Prevent-master/
- # zip -r webrtc_ext.zip *
- # mv webrtc.zip ..
- # cd ..
- # rm -rf WebRTC-Leak-Prevent
- # rm master.zip
- ###############################################################################################
- from selenium import webdriver
- from selenium.webdriver.common.keys import Keys
- from selenium.webdriver.chrome.options import Options
- import os, time
- #
- #PROXY = "localhost:1050"
- #desired_capabilities = {
- # "browserName": "chrome",
- # "version": "68.0",
- # "enableVNC": True,
- # "sessionTimeout": "40m"
- #
- #}
- #desired_capabilities['proxy'] = {
- # "httpProxy": PROXY,
- # "ftpProxy": PROXY,
- # "sslProxy": PROXY,
- # "noProxy": None,
- # "proxyType": "Manual",
- # "class": "org.openqa.selenium.Proxy",
- # "autodetect": False,
- # "socksUsername": "LOGin",
- # "sockPassword": "PAss"
- #
- #
- #}
- #
- #
- os.environ['HK']='Asia/Hong_Kong' # Change TIME ZONE
- time.tzset()
- ext_file = "webrtc.zip"
- mobile_emulation = {
- "deviceMetrics": {"width": 1920, "height": 1080, "pixelRatio": 3.0},
- "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36" }
- #mobile_emulation = {
- # "deviceMetrics": {"width": 375, "height": 667, "pixelRatio": 3.0},
- # "userAgent": "Mozilla/5.0 (iPhone 5; CPU iPhone OS 11_1_2 like Mac OS X ) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0 Mobile/15B202 Safari/604.1"}
- #mobile_emulation = {
- # "deviceMetrics": {"width": 1280, "height": 768, "pixelRatio": 3.0},
- # "userAgent": "Mozilla/5.0 (Windows; U; WinNT4.0; ru-ru; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1"}
- #mobile_emulation = {
- # "deviceMetrics": {"width": 1680, "height": 845, "pixelRatio": 3.0},
- # "userAgent": "Mozilla/5.0 (Windows 7; ru-ru; ) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/63"}
- device_choice = mobile_emulation
- print(device_choice)
- chrome_options = Options()
- chrome_options.add_extension(ext_file)
- chrome_options.add_experimental_option("mobileEmulation", device_choice)
- rand_proxy = "188.235.148.209:30554"
- print(rand_proxy)
- PROXY = rand_proxy # IP:PORT or HOST:PORT
- chrome_options.add_argument('--proxy-server=%s' % PROXY)
- chrome_options.add_argument('--lang= en')
- chrome_options.add_argument("--start-maximized")
- chrome_options.add_argument("--window-position=1367,0")
- #driver = webdriver.Remote("http://localhost:4444/wd/hub", desired_capabilities) #if use selenoid
- driver = webdriver.Chrome(chrome_options=chrome_options) # CHROME
- driver.get("https://whoer.net")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement