Search code examples
c#internet-explorerpdfui-automationwatin

Download generated and showed pdf automatically


I use WatiN for automating Internet Explorer. I have now a problem with a pdf-file. When i click on a button, there will be a pdf-file open in the browser:

enter image description here

Now, I want to download and save this pdf automatically so I can use it in my application. Can someone help me, how I can do that?


Solution

  • You absolutely can. As with everything else in WatIn you just need to find the correct piece of information to identify the element you need to deal with.

    In your screenshot I can see a PDF file embedded on something that looks like an iframe (please correct me if I'm wrong) if this is true all you need to know is the iframe SRC and the parameters sent to that iframe to get the PDF name, and from there you can use what Vijay suggested as from that point on it will be just a URL. Let me know if you need more details.