Note that there are some explanatory texts on larger screens.

plurals
  1. POClick on a link on C# WebBrowser to start download a file and also its link
    primarykey
    data
    text
    <p>I am using a <code>C# WebBrowser</code> to navigate to a page. After navigate to that page I extract some link from its source code and then start to navigate to those sub_links in a loop which I get from its parent url.</p> <p>On every sub_links there is a link which is look like: </p> <pre><code> &lt;a onclick="sysMT('SYSext.Sup_Filetype','type','SYSext.Sup_Filename','Filename.exe','SYSext.Sup_Referer','http://abc.com');" id="ctl00_UCDownloadFile1_Accept" href="javascript:__doPostBack('ctl00$UCDownloadFile1$Accept','')"&gt;Accept&lt;/a&gt; </code></pre> <p>the id of a button is <code>"ctl00_UCDownloadFile1_Accept"</code> is same in all its sub_links. When I click on above link manually a file start to download. I want to <code>"click"</code> on above button using c# code. I am able to <code>click</code> on above button using this code on <code>webBrowser1_DocumentCompleted event</code>: </p> <pre><code>HtmlElement elementById = webBrowser1.Document.GetElementById("ctl00_UCDownloadFile1_Accept"); if (elementById != null) { elementById.InvokeMember("click"); Application.DoEvents(); } </code></pre> <p>But a script error message box appear saying </p> <pre><code>"An error has occured in the script on this page. Error: The value of the property 'sysMT' is null or undefined, not a Function object. Do you want to continue running script on this page? Yes NO" </code></pre> <p>Not able to understand what I am missing in this. Did Parent url make some cookie which helps to download the file? Don't know how to download that file and also download file link.</p> <p>I am new to C# WebBrowser.</p> <blockquote> <p>Update</p> </blockquote> <p>I am able to remove a script error message box using </p> <pre><code>webBrowser2.ScriptErrorsSuppressed = true; </code></pre> <p>But not able to download all file which are their in sub links i.e.</p> <p>If I get 3 links from a parent url, then I navigate to first link, click on Accept link and then a box appear asking for a action to <code>RUN SAVE CANCEL.</code> But I get this box only for third (last) link. How to overcome with this problem, I want to download all file from each links without any prompt which asking for <code>RUN SAVE CANCEL.</code> Directly <code>SAVE</code> a file.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload