I have a problem and I couldn't figure out how to get around this. I am automating with the robot framework python. I'm going to google.com. I want to download and save the google image.
*** Variables ***
${b} chrome
${url} https://www.google.com/
${avatar} xpath://img[@alt='Google']
*** Test Cases ***
Test title
open browser ${url} ${b}
maximize browser window
sleep 1 seconds
page should contain image ${avatar}
element should be visible ${avatar}
open context menu ${avatar}
use run process
keyword from Process library and curl
command. Downloaded file will be in EXEC_DIR with name logo.png
.
This work for me:
*** Settings ***
Library Process
Library SeleniumLibrary
*** Variables ***
${b} chrome
${url} https://www.google.com/
${avatar} xpath://img[@alt='Google']
*** Test Cases ***
Test title
SeleniumLibrary.open browser ${url} ${b}
maximize browser window
sleep 1 seconds
page should contain image ${avatar}
element should be visible ${avatar}
${image_url}= Get Element Attribute ${avatar} src
log to console ${image_url}
Run Process curl -o logo.png ${image_url}
close all browsers