The message reads:
To help protect your security, Windows Internet Explorer blocked this site from
downloading files to your computer. Click here for more options...
I am receiving this error when I try to initiate a download after successfully filling a CAPTCHA in my ASP.NET (C#) website.
Has anybody faced this issue earlier? If so can you please let me know how you have tried to make it work. I have no option to remove the AJAX calls in my code.
This issue seems to be specific to IE7. The work around suggested for this issue by Microsoft is:
To ensure that your Web site downloads are not blocked, do not automatically launch a file download. Instead, use hyperlinks or buttons that require a user action. If you use a script to navigate to the resource, it must run synchronously within the context of the OnClick event handler for the link.
I even tried to create a button dynamically and trigger a click after my AJAX call is completed. Even then the issue is not resolved.
Try this
To stop the information bar from blocking file and software downloads
Open Internet Explorer by clicking the Start button , and then clicking Internet Explorer.
Click the Tools button, and then click Internet Options.
Click the Security tab, and then click Custom level.
Do one or both of the following:
To turn off the Information bar for ActiveX controls, scroll to the ActiveX controls and plug-ins section of the list, and then, under Automatic prompting for ActiveX controls, click Enable.
To turn off the Information bar for file downloads, scroll to the Downloads section of the list, and then, under Automatic prompting for file downloads, click Enable.
Click OK, click Yes to confirm that you want to make the change, and then click OK again.
Related
Issue: My selenium script is not recognizing and closing a dialog box that pops up when I redirect to a URl that contains file to download. The attached image shows the dialog I am referring to.
I know this has been asked a million times and I have spent at least 24 hours researching and trying other suggestions posted across the web but with no success. I am hoping the attached image will clarify which Firefox dialog box I am referring too.
I have tried the following solutions
1. Creating IAlerts (Alert element is not found)
2. Searching by trying to find the element by xpath (xpath to cancel was not found)
3. WindowsHandler Method (was not able to figure out the window name)
Any help on this would be greatly appreciated. Thank You in advance!
FireFox Dialog
There are several types of "popups".
Javascript dialogs - These are NOT HTML dialogs but are instead Javascript created dialogs. These consist of alert(), confirm(), and prompt() and can be handled with Alert.
HTML dialogs - These take on various forms depending on how they are formatted. If you right-click on the dialog and see the typical context menu for your browser, then it's an HTML dialog. They are part of the DOM of the current page so you can use Selenium to access this just as you would any other page (e.g., no window handles needed).
Browser window - These are actually another browser window that pops up and may look like a dialog, depending on how it's formatted. It's different than an HTML dialog because it can be moved outside of the current browser page frame. You will need to use window handles to access these windows as you would another tab in the browser. Once you get ahold of the window handle, you can access the HTML of the page like any other page.
Browser dialog - these take on various forms but are akin to System dialogs. They are not made up of HTML so they cannot be accessed by Selenium. Other than using a library to access them, you can interact with them in a limited fashion by sending keys such as <SPACE>, <TAB>, <ENTER>, etc.
What you have pictured is a (4) browser dialog. They it takes on different forms depending on the browser you do the action on. Your best course of action is probably send keys. Sometimes, depending on the browser, you can specify settings to autodownload a file to a specific location so that the dialog doesn't come up. I've never used this so I can't direct you there.
I was able to find and close a download dialog box by checking the amount of open windows after the dialog appears. This solution worked for me.
Find a link to open a dialog and click it:
var link = MyBrowser.Driver.FindElement(OpenQA.Selenium.By.Id("Button"));
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
js.ExecuteScript("arguments[0].click();", link);
Get the new window count after the dialog opens:
var newWindowCount = MyBrowser.Driver.WindowHandles.Count;
Switch to the newly opened dialog and close it:
MyBrowser.Driver.SwitchTo().Window(MyBrowser.Driver.WindowHandles[newWindowCount-1]);
MyBrowser.Driver.Close();
I want to apply the keyboard shortcut Ctrl+W (closes a browser tab) on an asp.net button. When I click on the asp.net button, it should work like the above controls. Is it possible? And if it is, from where can I get the code for Ctrl+W(close a browser tab).
window.close() won't work to close a browser's tab.
Simply put: it won't work, because you cannot close the current page with JavaScript (well, you can do it from your own developer console, but not from a script). Please take a look at this question for details: window.close and self.close do not close the window in Chrome
How can i get the control (and possibly its text value) of a control which was clicked in another third party application (its not a .net or wpf application for which there are answers which did not solve my problem)
I can get the click event in my app (using the global hooks as mentioned here) i want the control/handle of that particular UI Element
Example : I have opened Notepad and when i click on File Menu, i want the control of that File button.
Look at the documentation for SetWindowsHookEx using the WH_CALLWNDPROC param. This will let you intercept messages in Notepad window procedure. You'll need to figure out which messages get generated from clicking the menu items in Notepad, you can use Spy++ for that. But there is no real control for the File button, it is part of a menu.
I am developing a winform app which is controlling a website. On click of a button in winform app i want to fill a form, click the submit button on the web page upon which a new page will open , on that page i have to click on a link.
How to achieve this. i have tried many things but did not got any proper solution
If you're looking for a web automation tool, use Watin. It allows you to automate via code the opening of a browser, the clicking of buttons, and the fillout of form fields. However, that is more of a testing library.
Honestly though, your choice of solution sounds odd. You're trying to get a client application to make requests through a web page, instead of directly requesting whatever resource yourself from the client application. It's hard to give you a direct solution without a good understanding of the problem space.
I have an ASP.NET WebForm.
When users click on a link, it calls another page. That page, in turn, references an assembly and initiates a download, which takes some time to appear as it is rendered on the fly.
The issue:
I want to display a popup message: "Please wait download initiated" when users click the download button. When the Internet Explorer download window appears, I want to disable the original popup.
AFAIK, Elad is true. But you can try one thing. If your are throwing content from page, then just before writing content do the stuffs you want