-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebscraper.py
More file actions
36 lines (29 loc) · 1.13 KB
/
webscraper.py
File metadata and controls
36 lines (29 loc) · 1.13 KB
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
import time
from selenium import webdriver
from loginInfo import USERNAME, PASSWORD
import keyboard
def main():
DAILY_GIFTS_URL = "https://www.creativefabrica.com/daily-gifts/"
CLOSE_POPUP_TAG = "onesignal-slidedown-allow-button"
JOIN_PROMPT_DIV = "promo-upsell-popup-freebie-close"
driver = webdriver.Firefox()
driver.get(DAILY_GIFTS_URL)
driver.maximize_window()
time.sleep(3)
driver.find_element_by_id(CLOSE_POPUP_TAG).click()
driver.find_element_by_link_text("Close").click()
driver.execute_script("window.scrollTo(0, 300)")
driver.find_element_by_css_selector("span[class='btn-text']").click()
driver.find_element_by_name('username').click()
driver.find_element_by_name('username').send_keys(USERNAME)
driver.find_element_by_name('password').click()
driver.find_element_by_name('password').send_keys(PASSWORD)
keyboard.press_and_release("enter")
time.sleep(6)
driver.execute_script("window.scrollTo(0, 300)")
time.sleep(1)
driver.find_element_by_xpath("//span[@class='btn-text']").click()
time.sleep(5)
driver.quit()
if __name__ == "__main__":
main()