Last active
January 8, 2021 18:53
-
-
Save bbchriscesar/7fecb54f4ab7d7b6eb43f5bef6bb715d 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.common.keys import Keys | |
import os.path | |
import time | |
driver = webdriver.Firefox(executable_path=r'/root/PlayGround/geckodriver') | |
locales = ['en', 'ja', 'de', 'no'] | |
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(1) | |
driver.get_screenshot_as_file(path + '/' + 'google3.png') | |
time.sleep(1) | |
searchbox = driver.find_element_by_xpath("//input[@id='lst-ib']") | |
searchbox.send_keys('Whos your daddy') | |
searchbox.submit() | |
time.sleep(2) | |
driver.get_screenshot_as_file(path + '/' + 'searchresult3.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment