Skip to content

Instantly share code, notes, and snippets.

@hanjae-jea
Last active May 19, 2016 06:13
Show Gist options
  • Save hanjae-jea/4ca5b20a11889b24e84cd0d56a016cd5 to your computer and use it in GitHub Desktop.
Save hanjae-jea/4ca5b20a11889b24e84cd0d56a016cd5 to your computer and use it in GitHub Desktop.
packtpub crawl
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