Skip to content

Instantly share code, notes, and snippets.

@pybites
Created March 12, 2020 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pybites/0aa6d9833849a0942ed218b1d46c47b4 to your computer and use it in GitHub Desktop.
Save pybites/0aa6d9833849a0942ed218b1d46c47b4 to your computer and use it in GitHub Desktop.
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
@oleksis
Copy link

oleksis commented Mar 12, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment