Downloading Image using send Keys Selenium Chrome

0 votes

I have a link that is just an image.I need to download this to a specific place on my computer with a specific name.I have tried to send keys, like Ctrl + S, Name_of_the_file, enter and it won't go.It must be with the Webdriver, via Selenium. Below is the link:

 http://acervo.estadao.com.br/publicados/1973/03/22/m/19730322-30054-nac-0114-999-116-not.jpg
Jul 20, 2018 in Selenium by Martin
• 4,320 points
9,957 views

1 answer to this question.

0 votes

Use the below code to save the required image:

import requests

URL = "http://acervo.estadao.com.br/publicados/1973/03/22/m/19730322-30054-nac-0114-999-116-not.jpg"

with open("/Path/to/saved/file.jpg", "wb") as f:

    f.write(requests.get(URL).content)

 

If you want to do save picture via Selenium, try:

driver.get(URL)

driver.get_screenshot_as_file("/Path/to/saved/file.jpg")
answered Jul 20, 2018 by Samarpit
• 5,910 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

Downloading *.jar file from http:// seleniumhq.org using Selenium WebDriver

For Selenium Standalone Server: profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/java-archive"); If downloading ...READ MORE

answered Apr 17, 2018 in Selenium by Shubham
• 13,490 points
6,337 views
0 votes
1 answer

Using keys (Ctrl+A) in Selenium WebDriver

You can use the below code: String select ...READ MORE

answered May 9, 2018 in Selenium by Meci Matt
• 9,460 points
8,342 views
0 votes
1 answer

Handling pop up in Chrome using Selenium WebDriver

AutoIt Window Information Tool do not recognize ...READ MORE

answered Jun 11, 2018 in Selenium by Meci Matt
• 9,460 points
2,903 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,773 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,188 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,263 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,902 views
0 votes
1 answer
0 votes
1 answer

How to control Chrome Downloads page Using Selenium c#?

In your case you must replace 'cancel' ...READ MORE

answered May 7, 2018 in Selenium by Samarpit
• 5,910 points
9,772 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP