Skip to content

Instantly share code, notes, and snippets.

@bbchriscesar
Last active January 8, 2021 18:53
Show Gist options
  • Save bbchriscesar/707dfe3276a6c09278d1770c285cd8b4 to your computer and use it in GitHub Desktop.
Save bbchriscesar/707dfe3276a6c09278d1770c285cd8b4 to your computer and use it in GitHub Desktop.
from selenium import webdriver
import os.path
import time
#If you are using Chrome in the office, use the code below.
# driver = webdriver.Chrome(executable_path="chromedriver")
driver = webdriver.Firefox(executable_path=r'/root/PlayGround/geckodriver')
locales = ['en', 'ja', 'de']
for locale in locales:
path = '/root/PythonOutput/' + locale
if not os.path.exists(path):
os.makedirs(path)
driver.get('https://www.google.com/?hl=' + locale)
time.sleep(3)
os.system("""bash -c 'read -s -n 1 -p "\nTake a screenshot #1..."'""")
driver.get_screenshot_as_file(path + '/google1.png')
os.system("""bash -c 'read -s -n 1 -p "\nTake a screenshot #2..."'""")
driver.get_screenshot_as_file(path + '/google2.png')
print("\n\nScreenshot completed for " + locale)
time.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment