trigger javascript function using c# -


I have to write AC # class that triggers the contents of an html page (the page is public) and a javascript function One file that downloads is a file.

My goal is to download the file and save it to a folder

The page is a public HTML page, which does not require login.

The link looks like this:

  href = "javascript: __ doPostBack (& ​​lt; spreadsheet & amp; # 39; & amp; # 39; & Amp; # 39;) "style =" font-weight: 700 "& gt; Export results & lt; / A & gt; 

)! = False)) {theform .__ EVENTTARGET.value = eventTarget; The form .__EVENTARGUMENT.value = eventArgument; TheForm.submit (); }

When you manually click on the link, it submits the form and returns an Excel sheet, a dialog box will open to download it, where you have to save it .

I want to automate it to get excel sheet and then want to process it.

I found that I can find a link on a page like this:

  HtmlWeb Hw = new HtmlWeb (); HtmlDocument Doc = hw.Load (/ * url * /); HtmlNode link ("/ / [[ahref]") {}   

in the foreach (doc.DocumentElement.SelectNodes) but how can I trigger JavaScript in the link and return the file

Thank you

I do not think you can c # server Side web clients such as HTML or Webclient understand HTTP / HTML only, they are not able to execute Javascript in the same way that IE, Firefox or Crow I can.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -