Last active
August 2, 2018 11:33
-
-
Save 0xIslamTaha/2c42b57e6066a2e9975d7aade64da50f to your computer and use it in GitHub Desktop.
selenium tricks
This file contains 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
# 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