示例#1
0
 def login(self):
     driver.get(URL_LOGIN)
     driver.find_element_by_id("Client.UserName").send_keys("elisa")
     driver.find_element_by_id("Client.Password").send_keys("GGI")
     driver.find_element_by_xpath(
         "//*[@class='button' and @value='Login']").click()
     wait = WebDriverWait(driver, 5)
     element = wait.until(
         EC.presence_of_element_located((By.CLASS_NAME, "categories")))
示例#2
0
def key(selector, text):
    if type(selector) == str:
        print('Sending ' + text + ' to ' + selector)
        if selector[0] == '/':
            driver.find_element_by_xpath(selector).send_keys(text)
        else:
            driver.find_element_by_css_selector(selector).send_keys(text)
    else:
        print('Sending ' + text + ' to ' + str(selector))
        selector.send_keys(text)
示例#3
0
def enter(selector):
    if type(selector) == str:
        print('Sending ' + Keys.ENTER + ' to ' + selector)
        if selector[0] == '/':
            driver.find_element_by_xpath(selector).send_keys(Keys.ENTER)
        else:
            driver.find_element_by_css_selector(selector).send_keys(Keys.ENTER)
    else:
        print('Sending ' + Keys.ENTER + ' to ' + str(selector))
        selector.send_keys(Keys.ENTER)
示例#4
0
def click(selector):
    if type(selector) == str:
        print('Clicking: ' + selector)
        if selector[0] == '/':
            driver.find_element_by_xpath(selector).click()
        else:
            driver.find_element_by_css_selector(selector).click()
    else:
        print('Clicking: ' + str(selector))
        selector.click()
示例#5
0
def subscribe_account(link):
    try:
        driver.get(link)
        sleep(2)
        try:
            button = driver.find_element_by_xpath("//*[text()='Follow']")
        except:
            button = driver.find_element_by_xpath("//*[text()='Читать']")
        button.click()
        sleep(1)
    except:
        debug_screenshot("TWITTER_subscribe_account_")
示例#6
0
def user_login(username, password):
    driver.get("http://instagram.com")
    time.sleep(5)
    username_loc = driver.find_element_by_xpath("//input[@name='username']")
    password_loc = driver.find_element_by_xpath("//input[@name='password']")
    login_button = driver.find_element_by_xpath("//div/button/div[text()='Log In']")
    username_loc.send_keys(username)
    password_loc.send_keys(password)
    login_button.click()
    time.sleep(5)
    dismiss_elem_loc = driver.find_element_by_xpath("//button[text()='Not Now']")
    dismiss_elem_loc.click()
    time.sleep(5)
    notification_elem_loc = driver.find_element_by_xpath("//button[text()='Not Now']")
    notification_elem_loc.click()
    time.sleep(10)
示例#7
0
def add_to_friends(link):
    driver.get(link)
    try:
        add = driver.find_element_by_xpath("//a[@class='button wide_button acceptFriendBtn']")
        add.click()
    except:
        debug_screenshot("VK_add_to_friends_")
示例#8
0
def like_on_page(link):
    driver.get(link)
    try:
        like = driver.find_element_by_xpath("//a[@onclick='return ajax.click(this, Like);']")
        like.click()
    except:
        debug_screenshot("VK_like_on_page_")
示例#9
0
def join_group(link):  #work
    driver.get(link)
    try:
        join = driver.find_element_by_xpath("//a[@class='button wide_button']")
        join.click()
    except:
        debug_screenshot("VK_join_group_")
示例#10
0
def like_on_page(link):
    try:
        driver.get(link)
        page = driver.find_element_by_xpath(
            "/html/body/div[1]/div[3]/div[1]/div/div/div[2]/div[1]/div/div[2]/div/div[1]/div/div/div[1]/button"
        )
        page.click()
    except:
        debug_screenshot("FB_like_on_page_")
示例#11
0
def target_login():
    driver.get("https://vktarget.ru")
    text_area = driver.find_element_by_name("username")
    text_area.send_keys(TARGET_LOGIN)

    text_area = driver.find_element_by_name("password")
    text_area.send_keys(TARGET_PASSWORD)

    submit = driver.find_element_by_xpath("//div[@data-login='******']")
    submit.click()
示例#12
0
def twit_login():
    driver.get("https://twitter.com/login")
    sleep(1)
    try:
        text_area = driver.find_element_by_xpath(
            "/html/body/div[1]/div[2]/div/div/div[1]/form/fieldset/div[1]/input"
        )
        text_area.send_keys(TWIT_LOGIN)

        text_area = driver.find_element_by_xpath(
            "/html/body/div[1]/div[2]/div/div/div[1]/form/fieldset/div[2]/input"
        )
        text_area.send_keys(TWIT_PASSWORD)

        submit = driver.find_element_by_xpath("//button[@type='submit']")
        submit.click()
    except:
        text_area = driver.find_element_by_xpath(
            "//input[@name='session[username_or_email]']")
        text_area.send_keys(TWIT_LOGIN)

        text_area = driver.find_element_by_xpath(
            "//input[@name='session[password]']")
        text_area.send_keys(TWIT_PASSWORD)

        submit = driver.find_element_by_xpath("//div[text()='Войти']")
        submit.click()
def deletion_switch(deletion):
    something = ""
    if deletion == "1":
        Deletetask = driver.find_element_by_xpath(
            '//*[@id="task-1"]/div[1]/span/i[2]').click()
        print("Task 1 was deleted")
    elif deletion == "2":
        DeleteTask = driver.find_element_by_xpath(
            '//*[@id="task-2"]/div[1]/span/i[2]').click()
        print("Task 2 was deleted")
    elif deletion == "3":
        Deletetask = driver.find_element_by_xpath(
            '//*[@id="task-3"]/div[1]/span/i[2]').click()
        print("Task 3 was deleted")
    elif deletion == "4":
        Deletetask = driver.find_element_by_xpath(
            '//*[@id="task-4"]/div[1]/span/i[2]').click()
        print("Task 4 was deleted")
    elif deletion == "5":
        Deletetask = driver.find_element_by_xpath(
            '//*[@id="task-5"]/div[1]/span/i[2]').click()
        print("Task 5 was deleted")
    elif deletion == "6":
        Deletetask = driver.find_element_by_xpath(
            '//*[@id="task-6"]/div[1]/span/i[2]').click()
        print("Task 6 was deleted")
    else:
        print("use a number for the task")
示例#14
0
文件: Main.py 项目: MariaMsu/likeBot
def check_profit():
    i = 1
    driver.get("https://vktarget.ru/list/")
    while True:
        try:
            xpath = str("/html/body/div[22]/div/div[3]/div[7]/div[" + str(i) +
                        "]/div[6]")
            button = driver.find_element_by_xpath(xpath)
            sleep(random.uniform(2, 10))  # pause for stop yorzat'
            button.click()
            i += 1
        except selenium.common.exceptions.NoSuchElementException:
            break
示例#15
0
def insta_login():
    driver.get("https://www.instagram.com/accounts/login/")
    sleep(3)
    text_area = driver.find_element_by_name("username")
    text_area.send_keys(INSTA_LOGIN)

    text_area = driver.find_element_by_name('password')
    text_area.send_keys(INSTA_PASSWORD)

    submit = driver.find_element_by_xpath(
        "/html/body/span/section/main/div/article/div/div[1]/div/form/span/button"
    )
    submit.click()
    sleep(2)
示例#16
0
 def get_complaints_and_violations(self):
     self.num_of_complaints = 0
     self.num_of_dob_violations = 0
     self.num_of_ecb_violations = 0
     self.complaints_link = None
     self.dob_violations_link = None
     self.ecb_violations_link = None
     aNodes = driver.find_elements_by_tag_name("a")
     for node in aNodes:
         if "Violations-DOB" in node.text:
             violationNumberNode = driver.find_element_by_xpath(
                 DOB_VIOLATIONS_XPATH)
             self.num_of_dob_violations = int(violationNumberNode.text)
             self.dob_violations_link = node.get_attribute("href")
         elif "Violations-ECB" in node.text:
             violationECBNumberNode = driver.find_element_by_xpath(
                 ECB_VIOLATIONS_XPATH)
             self.num_of_ecb_violations = int(violationECBNumberNode.text)
             self.ecb_violations_link = node.get_attribute("href")
         elif "Complaints" in node.text:
             complaintNumberNode = driver.find_element_by_xpath(
                 COMPLAINT_XPATH)
             self.num_of_complaints = int(complaintNumberNode.text)
             self.complaints_link = node.get_attribute("href")
示例#17
0
 def get_building_id(self):
     textEl = driver.find_element_by_xpath(BUILDING_ID_XPATH)
     innerText = textEl.get_attribute("innerText")
     innerTextASCII = unidecode.unidecode(innerText)
     innerTextArr = innerTextASCII.split(' ')
     self.building_id = int(innerTextArr[2])
from driver import driver, Keys

driver.get("http://*****:*****@id="task-2"]/div[1]/div/span')
txt0 = Today0.text
print("first task found: " + txt0)
Today1 = driver.find_element_by_xpath('//*[@id="task-1"]/div[1]/div/span')
txt1 = Today1.text
print("second task found: " + txt1)

#placeholder so window doesnt close
test = input("press enter when done")
#joel Lee
#3/21/2021
#creates a due date for a task

from driver import driver, Keys
import time

#connects to website
driver.get("http://*****:*****@id="tasklist"]/div[1]/h2/span[1]/button').click()

time.sleep(2)

#finds the task input field
entertask = driver.find_element_by_xpath('/html/body/span[2]/div/div/span/input[1]')

time.sleep(1)

#asks the user for task name
task = input("Enter task name")
entertask.clear()
entertask.send_keys(task)

time.sleep(1)

dueDate = driver.find_element_by_xpath('/html/body/span[2]/div/div/span/input[3]')
MonthDayYear = input("input the Date using format Year-Month-Day Ex: 2021-03-22  :")
dueDate.clear()