-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
28 lines (21 loc) · 913 Bytes
/
Copy pathmain.py
File metadata and controls
28 lines (21 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
from scraping_jobs import job_posts
def main(web_driver, url):
web_driver.get(url)
# Find and click the "View All Jobs" button
view_all_jobs_button = WebDriverWait(web_driver, 10).until(
EC.presence_of_element_located((By.XPATH, '//*[@id="career-landing"]/div/div[4]/div/a')))
view_all_jobs_button.click()
# Wait for the new page to load
WebDriverWait(web_driver, 10).until(EC.url_changes(url))
job_posts(web_driver)
if __name__ == '__main__':
# Web URL to scrape the jobs list
job_post_url = f'https://www.cermati.com/karir'
# check for different Browser, if Chrome doesn't exist
driver = webdriver.Chrome()
main(driver, job_post_url)
driver.quit()