Created
October 2, 2020 15:31
-
-
Save Ilyaok/ccdee6f5d7b5da84b6db33cffc4a3b76 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 urllib.request import urlopen | |
| from bs4 import BeautifulSoup | |
| from selenium import webdriver | |
| from selenium.webdriver.common.keys import Keys | |
| import time | |
| import pandas as pd | |
| driver = webdriver.Chrome('C:/Users/Илья/Downloads/chromedriver_win32/chromedriver.exe') | |
| driver.get("https://hays.ru/search/") | |
| for i in range(5): | |
| driver.find_element_by_tag_name('body').send_keys(Keys.END) | |
| time.sleep(1) | |
| VacHeads = [] | |
| for temp in driver.find_elements_by_tag_name("h3"): | |
| VacHeads.append(temp.text) | |
| Industries = [] | |
| for temp in driver.find_elements_by_class_name("svc-search-results__position"): | |
| Industries.append(temp.find_element_by_tag_name("p").text) | |
| Locations = [] | |
| for temp in driver.find_elements_by_class_name("locations-labl"): | |
| Locations.append(temp.find_element_by_tag_name("span").text) | |
| table = {"Vacancy": VacHeads, "Industry": Industries, "Location": Locations} | |
| frame = pd.DataFrame(table) | |
| writer = pd.ExcelWriter("Hays_Vacancies.xlsx", engine='xlsxwriter') | |
| frame.to_excel(writer, "Vacancies") | |
| writer.save() | |
| driver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment