Created
January 14, 2021 05:25
-
-
Save bbchriscesar/a50488301cd59efe9065bf6d5edbc2c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
import os | |
import time | |
mobile_emulation = { | |
"deviceMetrics": { "width": 411, "height": 731, "pixelRatio": 3.0 }, | |
"userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19" } # For LINUX | |
#"userAgent": "mobile web mac : "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36" } # For MAC | |
options = Options() | |
options.add_experimental_option("mobileEmulation", mobile_emulation) | |
options.add_argument('user-data-dir=/usr/local/google/home/christiannec/.config/google-chrome/Profile_05') | |
driver = webdriver.Chrome(executable_path="/usr/local/google/home/christiannec/ChromeBrowserDriver/chromedriver_01", options=options) | |
driver.maximize_window() | |
driver.get('https://www.youtube.com') | |
print('Press ENTER to take screenshot #2') | |
os.system('read -s -n 1 -p "Press any key to continue..."') | |
driver.save_screenshot('/usr/local/google/home/christiannec/test.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment