Skip to content

Instantly share code, notes, and snippets.

@0xIslamTaha
Last active August 2, 2018 11:33
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 0xIslamTaha/2c42b57e6066a2e9975d7aade64da50f to your computer and use it in GitHub Desktop.
Save 0xIslamTaha/2c42b57e6066a2e9975d7aade64da50f to your computer and use it in GitHub Desktop.
selenium tricks
# upload file
from selenium import webdriver
url = 'https://files.fm/'
file_path = '/home/xtremx/Desktop/bg.png'
driver = webdriver.Chrome()
driver.get(url)
upload_elemnet = driver.find_element_by_xpath('//*[@id="uploadifive-file_upload"]/input[2]')
upload_elemnet.send_keys(file_path) # handle pop-up menu
driver.find_element_by_xpath('//*[@id="savefiles"]/div').click() #handle next_button
# download file
url = 'https://chromedriver.storage.googleapis.com/index.html?path=2.41/'
driver.get(url)
download_element = driver.find_element_by_link_text('chromedriver_linux64.zip')
download_element.click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment