Save Button in Save as Dialogue Box Window

Hi Guys,

please anybody give me a solution for the ruby code for the save button
in save as dialogue box.

actually am using this code for save a page

@browser.action.key_down(:control)
.send_keys(“s”)
.perform.click

But issue is that if am using the above code, a save as dialogue box
will open (please see the attachment image). But after that i dont know
which is the ruby code for clicking the save button in this window. so
please anybody give me a better solution.

Thanks
Hareend

Have you read the Watir guide about downloads?
http://watirwebdriver.com/browser-downloads/

Hello,

already i use this code. but it will not success my work. is there any
other solution

Thanks
hareend

If all you want to do is save the page source, why are you pressing
Control S when you could just take all the html and write it into a
file?

File.write( ‘myfile.htm’, @browser.html )

Hello Joel,

Thank you for your reply…

actually the main issue is that when i press submit button from my main
page and my output shown in another page, but the url of my output page
look like this.(eg:
https://www.testviewer.com/print.html?PrintType=B2BOutput).

so can you please give me a solution for saving this page as pdf format.
i try almost every code. please give me a good solution…

Thanks
Hareend

Wait… are you trying to convert a HTML page into a PDF file, or are
you trying to save a PDF file that’s being displayed in Chrome?

Yes…am trying to convert a HTML page(eg:
https://www.testviewer.com/print.html?PrintType=B2BOutput) into a pdf
file.

There’s nothing built into webdriver that I know of able to handle
chrome’s print to PDF. You’ll need to find a chrome extension with an
API that can do this, save the HTML as shown above and then convert to
PDF, or manually send keypresses (although the latter is usually
unstable and considered bad coding).

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs