Python 3 Selenium Automation Script to Download a Text or PDF File From URL in Browser Full Project For Beginners

 

 

pip install selenium

 

 

 

app.py

 

 

# Import Module
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

# Open Chrome
driver = webdriver.Chrome(
	'chromedriver.exe')

# Open URL
driver.get(
	'http://demo.automationtesting.in/FileDownload.html')

# Enter text
driver.find_element_by_id('textbox').send_keys("Hello world")

# Generate Text File
driver.find_element_by_id('createTxt').click()

# Click on Download Button
driver.find_element_by_id('link-to-download').click()

 

 

Leave a Reply