forked from riyaa14/Updates_Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meta.py
45 lines (33 loc) · 1.24 KB
/
meta.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
import pymongo
from pymongo import MongoClient
client=pymongo.MongoClient("mongodb://localhost:27017/")
print(client)
db=client["DiscordBot"]
collection=db["Website"]
id="4"
url = 'https://www.metacareers.com/jobs'
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(options=options)
driver.maximize_window() # For maximizing window
driver.implicitly_wait(20) # gives an implicit wait for 20 seconds
driver.get(url)
driver.find_element(
By.XPATH, '//*[@id="search_result"]/div/div[1]/div[2]/div[2]/div[2]/div[1]').click()
time.sleep(5)
WebDriverWait(driver, 10).until(
EC.presence_of_all_elements_located((By.CLASS_NAME, "_8sel")))
driver.execute_script("window.scrollTo(0, 200)")
title = driver.find_element(By.CLASS_NAME, '_8sel').text
location = driver.find_element(By.CLASS_NAME, '_8see').text
print(title.text)
print(location)
####### database #####
# 1. title
# 2. location