Sandeep Raulo
Sandeep Raulo

Reputation: 154

Copy xml being displayed in web browser and save as .xml

I'm having a requirement where I have to open a url in browser which will show an .xml file in response (in the browser) and I have to save the file in my local directory with extension as .xml i have already tried with action class to perform Ctrl + save but neither error nor output is coming. Tried with action class but it is showing vh_ctrl cannot be resolved.

Any input will be appreciated.

Upvotes: 0

Views: 913

Answers (3)

Breaks Software
Breaks Software

Reputation: 1761

You don't say which programming language you are using, but since Selenium is not designed for interacting with the OS I would recommend that you avoid using Selenium altogether. Just use the capability of your programming language to make an HTTP request to the server to retrieve the target file directly. Or just use wget or cURL.

Upvotes: 0

KKK
KKK

Reputation: 121

I wanted to compliment the answer but can not do that, so I am writing my reply as an answer. Have you imported java.awt.event.KeyEvent; You will need this class for robot.keyPress(KeyEvent.VK_ENTER);

I have used Robot for uploading the attachment on webpage through Selenium and it works for me fine.

Upvotes: 0

yong
yong

Reputation: 13712

If you use java, you can try package java.awt.robot to send Ctrl+S keys.

For selenium Actions class should not support to do that.

Upvotes: 1

Related Questions