Created
March 12, 2020 08:48
-
-
Save pybites/0aa6d9833849a0942ed218b1d46c47b4 to your computer and use it in GitHub Desktop.
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
import os | |
# make venv and pip install selenium | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
# set your codechalleng.es username and password in venv/bin/activate, then source it | |
user = os.getenv('PB_USER') | |
password = os.getenv('PB_PW') | |
driver = webdriver.Chrome() | |
base_url = 'https://codechalleng.es' | |
login_url = f'{base_url}/login/' | |
driver.get(login_url) | |
driver.find_element_by_name('username').send_keys(user) | |
driver.find_element_by_name('password').send_keys(password + Keys.RETURN) | |
# I am logged in, let go to a Bite | |
bite_url = f'{base_url}/bites/101' | |
driver.get(bite_url) | |
# do your thing | |
html = driver.page_source |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!