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,220 points
2,269 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,130 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,310 points
459 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,420 points
1,965 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,420 points
730 views
0 votes
1 answer

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,110 points
999 views
0 votes
1 answer
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,130 points
1,148 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
891 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,130 points
1,852 views