Last active
May 19, 2016 06:13
-
-
Save hanjae-jea/4ca5b20a11889b24e84cd0d56a016cd5 to your computer and use it in GitHub Desktop.
packtpub crawl
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 selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.support import expected_conditions as EC | |
import time | |
driver = webdriver.Firefox() | |
driver.get("https://www.packtpub.com/packt/offers/free-learning") | |
time.sleep(10) | |
body = driver.find_element_by_tag_name('body') | |
body.send_keys(Keys.ESCAPE) | |
time.sleep(1) | |
claim = driver.find_element_by_class_name('book-claim-token-inner') | |
claim.click() | |
time.sleep(3) | |
email = driver.find_element_by_id('email') | |
email.send_keys('[email protected]') | |
driver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment