import time
import tkinter
from myModules import browser
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from tkinter import messagebox

tkinter.Tk().withdraw()

options = Options()
options.add_argument('use-fake-ui-for-media-stream')
options.add_argument('--headless')
browser = browser.Chrome(options=options)
browser.get("https://www.aha-music.com/")
time.sleep(5)
messagebox.showinfo('Recording',
                    'Click This When You Would Like To Recognize The Song')
browser.find_element(
    By.XPATH, "//div[@id='__layout']/div/div/div[2]/div/button").click()
messagebox.showinfo('Recording', 'Click This When Your Done Recording')
print(
    browser.find_element(
        By.XPATH, "/html/body/div/div/div/div/div[2]/div[1]/div/div[1]").text)
browser.close()
示例#2
0
Username = input('\nUsername: '******'Password: '******'default' or Username and Password == 'd':
    Username = Username_Default
    Password = Password_Default

engine = pyttsx3.init()
browser = browser.Chrome()
pyautogui.moveTo(1565, 97)
pyautogui.click()
pyautogui.moveTo(random.randint(0, 1000), random.randint(0, 1000))
browser.get('https://entrar.in/login/login')

username = WebDriverWait(browser, 10).until(
    EC.presence_of_element_located((By.NAME, 'username')))
username.send_keys(Username)

password = WebDriverWait(browser, 10).until(
    EC.presence_of_element_located((By.NAME, 'password')))
password.send_keys(Password)

sign_in_button = WebDriverWait(browser, 10).until(
    EC.presence_of_element_located(
        (By.XPATH, '//button[contains(.,\'Log-In with Entrar\')]')))
sign_in_button.click()

browser.execute_script('alert(\'Close Any Popups  Time: 10 Seconds\')')
def download_thumbnail(thumbnail_url, fname='thumbnail_youtube.png'):
    time.sleep(10)
    browser.get(thumbnail_url)
    open(fname, 'a')
    browser.save_screenshot(fname)
    return fname


options = Options()
options.add_argument('--headless')
browser = browser.Firefox(options)
url = 'https://www.youtube.com/channel/UCmse86kaxJ3n1dDT_bXDukg'
mins = 10

while True:
    browser.get(url)
    video = browser.find_element_by_xpath('//*[@id=\'video-title\']')
    video_title = str(video.text)

    F = open('titles.txt', 'r')
    past_title = F.readline()
    F.close()

    if past_title == video_title:
        print('Don\'t Post to twitter')
    else:
        video.click()
        video_url = str(browser.current_url)
        id = video_url.split('=', 1)[1]
        browser.get('https://www.youtube.com/')
        thumbnail_url = 'https:///img.youtube.com/vi/' + id + '/maxresdefault.jpg'
def download_thumbnail(thumbnail_url, fname='thumbnail_youtube.png'):
    time.sleep(10)
    browser.get(thumbnail_url)
    open(fname, 'a')
    browser.save_screenshot(fname)
    return fname
import time
from myModules import browser

browser = browser.Chrome()
browser.get('https://web.whatsapp.com/')
time.sleep(3)
element = browser.find_element_by_class_name('_3l6Cf')
code = element.get_attribute('innerHTML')
code = code.split('data-ref="')[1]
code = code.split('"><span>')[0]
print(code)
# ...
time.sleep(10)
wait = WebDriverWait(browser, 600)
target = 'ABC'
string = "Python sent a message"
x_arg = ' //span[contains(@title, ' + '\"' + target + '\"' + ')]'
target = wait.until(ec.presence_of_element_located((By.XPATH, x_arg)))
target.click()
input_box = browser.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[2]/div/div[2]')
input_box.send_keys(string)
input_box.send_keys(Keys.ENTER)