I'm posting some form values to a form using HttpWebRequest. The problem is that the post behaves differently depending on javascript function call results. Javascript runs on the client browser, so I'm doubting I can get around this problem, but does anyone know a way of mimic-ing a browser's behavior with regard to javascript from C# code?
Alternatively, is there a way for me to manipulate Internet Explorer to get and post values to different U开发者_C百科RLs from a C# Windows Service? Can it be done with a WinForms app?
Yes, you can automate browsers from any .NET application using an automation framework:
- Selenium
- WatiN
You can run Javascript in cscript.exe. You don't get the browser API, but you can use Javascript libraries, can do AJAX, XMLHTTPRequest, etc.
You can also use a MSHTML control within a C# app to retrieve a web page. That is effectivedly embedding IE into your app, including running browser-side Javascript.
精彩评论