Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Code to log into a website(Will need to tweak it on a per website basis)
- # initialize driver as chrome
- import urllib
- from selenium import webdriver
- driver = webdriver.Chrome()
- # tell driver to go to website
- driver.get('https://website.com/')
- # user and pass
- username = "username"
- password = "password"
- # enter user and pass
- inputElement = driver.find_element_by_id("username")
- inputElement.send_keys(username)
- inputElement = driver.find_element_by_id("password")
- inputElement.send_keys(password)
- # WORKING CODE TO PULL ALL IMAGES FROM IMGUR(Will keep overwriting as test.png)
- # import urllib
- # from selenium import webdriver
- #
- #
- # driver = webdriver.Chrome()
- #
- # driver.get('http://imgur.com/')
- #
- # images = driver.find_elements_by_tag_name('img')
- # for image in images:
- # image_name = image.get_attribute('src')
- # print(image_name) # prints the url in console
- # # Pull the image from from imgur and save it on disk as "test.png"
- # urllib.request.urlretrieve(image_name,"test.png")
- #
- # driver.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement