Visual Basic - download from WebBrowser - vb.net

I'm pretty new to visual basic, but have been looking far and wide and have had no luck finding an answer to this anywhere. I've used WebBrowser to navigate to a webpage. On this page there's a link to click which will then download a csv file.
I've got my program to click this link using:
WebBrowser1.Document.GetElementById("elementID").InvokeMember("click")
But I'm not sure how to handle the 'file download' dialog box that pops up. One way, I'm thinking, is to use sendkeys to click the 'save' button, but this seems a bit clunky.
I'm wondering if I can use FileDownload somehow to handle this box before it pops up. (Microsoft's documentation says: "If a file download dialog box can be displayed, this event fires prior to the appearance of the dialog box.")
Any know if this is possible or do you have any other smart ideas for solving this problem?

Related

PDF.js / PDFViewer should Trigger "Always Ask" Window - not SaveAs

I´ve got reports from some Users which were used to the Firefox "Always Ask" Window or "how to handle the download" Question, when klicking the "Save" button in the in-Browser PDF.js viewer.
Screenshot of PDF.js Plugin with marked SaveAs Button
This does not seem to work now, I am not sure if it happened after an update or something broke.
Anyone know the solution how to alter the setting? The usual Way in Firefox doesnt affect this, even the right setting is active, If I want to download a regular PDF by link, I get the correct "Always Ask" Window, but not inside PDF.Js.
If You ask Yourself why I am asking this if its set on "Always Ask" Anyway - There are certain applications which seem to force the appearance of an embedded PDF.Js viewer regardless from the setting - from here it is desirable, if the user could then decide what happens if clicked on the Save Button.

Can I make popup screen or file upload automatically with selenium?

Good morning. I have a web page control with selenium. However, when I click the button of the site, a pop-up screen appears and I want to test that the file attachment is saved by pressing the file attachment button in it. Can you control selenium with two windows (parent, child-popup) going up and down?
I guess you want to interact with file upload dialog which is native window via selenium. That is not possible. However you can select file to upload using sendKeys without the dialog being opened.
Something like that
fileInput.sendKeys("/path/to/local/file");

PDFtron close a tool when doing Frame.GoBack()

Im using PDFtron on a windows store app project.
I have a page with a back button and a pdf viewer where i can edit the pdfs.
When im editing a pdf i have a tool bar with options like the ones in the samples, but i have a issue when i choose a Free Text tool and start writing on the pdf, if i press the back button while the Free Text tool is active ( the cursor is bliking) the text i wrote appears in the screen on the next page i navigate to.
How can i solve this?
The TextBox in question is part of the PDFViewCtrlTools that are used to create annotations. It is shipped with the sample application and is fully open source.
The TextBox is inside a popup, positioned to align itself on top of the PDFViewCtrl in the position where you tapped.
This TextBox needs to be closed before you go back. It is quite easy to do so by calling ToolManager.CreateDefaultTool(). In general, I would recommend taking a look at the samples and see what they're doing when the user tries to navigate away from the page.
Everytime you navigate away from a page with PDFViewCtrl, the ToolManager should call CreateDefaultTool so that whatever current tool is active (in this case the FreeTextCreate tool) can close itself and clean up.

How to click on Open/save/save as/cancel button on IE 11 using vba

I would like to click on open when a file download dialog appear in IE 11. I found this code http://www.siddharthrout.com/2011/10/23/vbavb-netvb6click-opensavecancel-button-on-ie-download-window/
But this code does not work with IE11. I have also attached the IE11 download dialog box here too. Anyone has any idea, please, help.
You can use Alt+N to focus on the Notification Bar.
And then send {tab} key to navigate to the specific button.
With VBA, you may use Autohotkey.dll or AutoItX3.dll to send these hotkey combinations.

How can I send clicks or keys from a VB6 app to an Excel dialog box?

My employer has purchased a third-party tool, OfficeConverter from Conveter Technology that automates the conversion / repair of Office 2003-formatted files to Office 2007 format. This tool also highly automates the translation / change in macro / VBA code requirements between Office 2003 and 2007 formats.
My problem is that during this conversion the tool is opening the targeted Office product, say Excel and is then opening the target user file (ie. Report.xls) and is then examining any VBA / macro code for change requirements. The problem is that IF the Excel file code is dependent upon some external tool like an .OCX file and if that tool doesn't exist on the PC that I'm performing this action on, Excel will pop up a message that the Object has not been found, stopping the entire conversion process (thousands of files in a row) until someone comes along and MANUALLY clicks the appropriate button to close the dialogue box.
I figured that creating a small watching application in VB6 (hey, I'm old and my skills are too) could sit on the same PC and watch for these dialogue boxes and, depending on the specific message, click the appropriate button via the SendMessage API call.
The problem is that I haven't been able to get SendMessage to actually PUSH the button for me, I've tried sending it the Return key value (vbKeyReturn) or even the Space key (vbKeySpace) but the action never results in the dialogue box closing like it should. I can get the focus to tab between whichever buttons on the dialogue box are enabled, but that is about it.
I've attempted to use SendKeys, but that is far less reliable and strongly discouraged in the current documentation that I've come across.
Any suggestions? :)
If you have the hWnd for the button, and the machine is unattended, you can easily use MouseEvent to move the cursor over the button and click it. This sample includes a drop-in ready module that'll do the dirty work for you given just the window handle:
http://vb.mvps.org/samples/MouseEvent
Otherwise, the most straightforward way is probably to just send WM_LBUTTONDOWN and WM_LBUTTONUP sequentially.
EDIT: If you "just want to get it done" take Jim's advice and try Gary Chanson's Window Demon tool.
Take a look at this utility "Window Demon" by Gary Chanson
Karl: how quickly we forget our pals!
I would suggest taking a look at AutoIt.
It is perfect for this task, look for a window with a particular text on it and click a button.
Runs in the system tray as a standalone application.