Created
May 22, 2017 16:44
-
-
Save filinvadim/520b07e98a8a458c18a2cd5ed91044c6 to your computer and use it in GitHub Desktop.
Автоматическое обновление резюме на HH.ru
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.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
import datetime | |
import time | |
while True: | |
# opening_browser | |
driver = webdriver.Firefox() | |
# opening_url_of_cv(*args): | |
cv_url = "" #direct URL to your CV | |
driver.maximize_window() | |
driver.get(cv_url) | |
# pushing_plus_button | |
plus_button_xpath = '//a[@data-qa="bloko-tag__increase"][1]' | |
WebDriverWait(driver, 40).until( | |
EC.visibility_of_element_located((By.XPATH, plus_button_xpath)) | |
) | |
plus_button_located = driver.find_element_by_xpath(plus_button_xpath) | |
plus_button_located.click() | |
# authorizing | |
WebDriverWait(driver, 40).until( | |
EC.visibility_of_element_located((By.NAME, 'username')) | |
) | |
username_field = driver.find_element_by_name("username") | |
username_field.send_keys('') # write down your email here | |
password_field = driver.find_element_by_name("password") | |
password_field.send_keys('') # write down your password here | |
enter_button = driver.find_element_by_xpath( | |
'//input[@class="bloko-button bloko-button_primary bloko-button_stretched"]' | |
) | |
enter_button.click() | |
# pushing_refresh_button | |
refresh_button = "//button[@class='bloko-button bloko-button_primary bloko-button_stretched noprint HH-Resume-Touch-Button']" | |
WebDriverWait(driver, 30).until( | |
EC.element_to_be_clickable((By.XPATH, '//h1[@data-qa="resume-personal-name"]')) | |
) | |
refresh = driver.find_elements_by_xpath(refresh_button) #actually there are two similar buttons so it would be a list | |
if refresh[1].is_enabled(): | |
refresh[1].click() | |
if not refresh[1].is_enabled(): | |
print(time.ctime(), 'Refreshed successfully!') | |
else: | |
print("Error!") | |
else: | |
print(time.ctime(), 'No need to refresh.') | |
driver.quit() | |
time.sleep(14400) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment