Download pdf in pdf-viewer

I need to click button to download pdf inside a pdf-viewer using robot framework.

can someone help me please?

tks

I assume that the PDF viewer is dependent on what browser you are using. That click you want can only be done with Compute Vision /Image Recognition framework, because it is not HTML (or is hidden code). After clicking the icon you would probably get a dialog to where to save the file.
You can try to save the file before it opens in PDF viewer, because then you are still in the HTML context.

For Image Recognition based framework, I recommend SikuliLibrary==> pip install robotframework-sikulilibrary

3 Likes

Hi,

With which library, browser/application do you need this?

I would assume this is a browser, so maybe some hints or solution in this topic:

But if you have more précise input info it would be easier to help

Regards

Charlie

1 Like

Hi,

the browser is Chrome and library is SeleniumLibrary.

tks

I found on solution. I get de href link in element #document and save the PDF in an directory.

Select Frame //[@id=“iframeasp”]
Select Frame //
[@id=“principal2”]
Select Frame //*[@name=“fila_pdf”]
${href_pdf}= Execute Javascript return window.location.href
${path_parts}= Split String ${href_pdf} /
${nome_arquivo_inteiro}= Get From List ${path_parts} -1
${string_nome_arquivo}= Split String ${nome_arquivo_inteiro} ?
Log ${string_nome_arquivo[0]}
${nome_arquivo_pdf}= Set Variable ${string_nome_arquivo[0]}
${response}= Get ${href_pdf}
${result}= Set Variable ${response.content}
Should Be Equal As Strings ${response.status_code} 200
Create Binary File ${diretorio}${nome_arquivo_pdf} ${result}
Sleep 10s
Move File ${diretorio}${nome_arquivo_pdf} ${download_directory}/${nome_arquivo_pdf}

tks

1 Like