Skip to content

Instantly share code, notes, and snippets.

@m0pfin
Created December 8, 2021 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m0pfin/fdb1a699691cbc081f2eb38a5fb47bec to your computer and use it in GitHub Desktop.
Save m0pfin/fdb1a699691cbc081f2eb38a5fb47bec to your computer and use it in GitHub Desktop.
Automated send ticket for Adspower
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import requests
import unittest, time, re
import random
import string
profile = open('ticket.txt', 'r')
lines = profile.readlines()
profile_id = lines[0].strip()
print('ID profile: %s' % (profile_id))
ads_id = str(profile_id)
open_url = "http://local.adspower.net:50325/api/v1/browser/start?user_id=" + ads_id
close_url = "http://local.adspower.net:50325/api/v1/browser/stop?user_id=" + ads_id
resp = requests.get(open_url).json()
chrome_driver = resp["data"]["webdriver"]
chrome_options = Options()
chrome_options.add_experimental_option("debuggerAddress", resp["data"]["ws"]["selenium"])
driver = webdriver.Chrome(chrome_driver, options=chrome_options)
#Perform automation
time.sleep(5)
driver.get('https://support.google.com/google-ads/contact/pf_suspended?ctx=123')
time.sleep(5)
#assert "Multilogin - Replace Multiple Computers With Virtual Browser Profiles - Multilogin" in driver.title
ad_account = driver.find_element(By.XPATH, '//*[@id="awcid_select"]/sc-shared-cid-selector/div/hcfe-search-select-select/div').click
ad_account_select = driver.find_element(By.XPATH, '//*[@id="awcid_select"]/sc-shared-cid-selector/div/hcfe-search-select-select/hcfe-search-select-menu/sc-shared-material-popup/div/div').click
#phone = driver.find_element(By.XPATH, '//*[@id="pf_suspended"]/div[8]/input')
website = driver.find_element(By.XPATH, '//*[@id="website_req"]')
keywords = driver.find_element(By.XPATH, '//*[@id="sample_keywords"]')
street_adress = driver.find_element(By.XPATH, '//*[@id="billing_address_street"]')
zippcode = driver.find_element(By.XPATH, '//*[@id="billing_address_zip"]')
city = driver.find_element(By.XPATH, '//*[@id="billing_address_town"]')
who_pays = driver.find_element(By.XPATH, '//*[@id="who_pays"]')
desc_business = driver.find_element(By.XPATH, '//*[@id="business_desc"]')
summary_of_issue = driver.find_element(By.XPATH, '//*[@id="summary_of_issue"]')
#Click the link which opens in a new window
driver.execute_script("document.getElementById(':246').click()")
# Returns true if element is checked else returns false
checkbox = driver.find_element(By.XPATH, '//*[@id="pf_suspended"]/div[18]/fieldset/div[1]/div/label/span').click()
checkbox2 = driver.find_element(By.XPATH, '//*[@id="pf_suspended"]/div[19]/fieldset/div[1]/div/label/span').click()
#Click the link which opens in a new window
driver.execute_script("document.getElementById(':262').click()")
#Click the link which opens in a new window
driver.execute_script("document.getElementById(':328').click()")
#Enter login and pass
delay = 100
website.send_keys('https://edelweissrest.com') # GG First name
delay = 100
#phone.send_keys('8478203829') # GG First name
delay = 400
keywords.send_keys('restuarant') # GG Last name
delay = 200
street_adress.send_keys('610 E Willamette Ave, Colorado Springs') # GG login name
delay = 400
zippcode.send_keys("80903")
delay = 300
city.send_keys("Colorado Springs")
delay = 300
desc_business.send_keys("I have a restaurant business")
delay = 300
who_pays.send_keys("I am")
delay = 300
summary_of_issue.send_keys("Hello unlock my account plz")
print ("Аппеляция подана!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment