Skip to content

Instantly share code, notes, and snippets.

@bbchriscesar
Created October 29, 2018 15:20
Show Gist options
  • Save bbchriscesar/607655bce63c42340b190ff20ed1f8a1 to your computer and use it in GitHub Desktop.
Save bbchriscesar/607655bce63c42340b190ff20ed1f8a1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 29 23:19:42 2018
@author: christiannec
"""
from selenium import webdriver
import time
import os.path
driver = webdriver.Chrome(executable_path="chromedriver")
driver.maximize_window()
#Locales
locales = ['en', 'hi', 'ja', 'de']
for locale in locales:
#Change the path to the folder you want to save your screenshot
path = '/usr/local/google/home/christiannec/PythonOutput/' + locale
if not os.path.exists(path):
os.makedirs(path)
driver.get('https://ads-nightly.qa.adz.google.com/aw/overview?__u=2270794480&__c=2599628760&ocid=25240&hl=' + locale)
time.sleep(5)
driver.get_screenshot_as_file(path + '/' + 'Overview.png')
time.sleep(2)
driver.find_element_by_xpath("//*[@navi-id='Campaigns-tab']").click()
time.sleep(2)
driver.get_screenshot_as_file(path + '/' + 'Campaigns.png')
time.sleep(2)
driver.find_element_by_xpath("//*[@navi-id='toolbelt-fab-add-button']").click()
time.sleep(2)
driver.get_screenshot_as_file(path + '/' + 'Add.png')
time.sleep(2)
driver.find_element_by_xpath("//*[contains(@class,'menu-item ')][@data-item-index='0']").click()
time.sleep(2)
driver.get_screenshot_as_file(path + '/' + 'New_Campaign.png')
time.sleep(2)
driver.find_element_by_xpath("//*[contains(@class,'goal _ngcontent')]").click()
time.sleep(1)
driver.find_element_by_xpath("//*[contains(@class,'card card--secondary channel-card')]").click()
time.sleep(1)
driver.find_element_by_xpath("//*[contains(@class,'btn btn-yes _ngcontent')]").click()
time.sleep(5)
driver.get_screenshot_as_file(path + '/' + 'New_Campaign_01.png')
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment