webbrowser-control

WPF WebBrowser Mouse Events not working as expected

早过忘川 提交于 2019-11-26 10:00:17
问题 I have a WebBrowser object in a WPF Page and I\'m trying to do something whenever the user interacts with the page. I have intially tried to use the events associated with the WebBrowser object but they don\'t seem to be firing. Below is a simplified example of what my code is trying to do: webBrowser.MouseDown += new MouseButtonEventHandler(webBrowser_MouseDown); with the event handler as: void webBrowser_MouseDown(object sender, MouseButtonEventArgs e) { System.Windows.MessageBox.Show(\

How do I programmatically change printer settings with the WebBrowser control?

穿精又带淫゛_ 提交于 2019-11-26 09:45:56
问题 I finally figured out how to print transformed XML without prompting the user or showing an IE window, but now I need to specify a number of copies and possibly other printer settings. Is there a way to programmatically change printer settings on a WebBrowser control? The code in question: private static void PrintReport(string reportFilename) { WebBrowser browser = new WebBrowser(); browser.DocumentCompleted += browser_DocumentCompleted; browser.Navigate(reportFilename); } private static

How to disable click sound in WebBrowser Control

左心房为你撑大大i 提交于 2019-11-26 09:26:37
问题 I use Javascript to click a link in the webbrowser control. But I don\'t want to hear IE\'s \"click\" sound. Is there any way to do this? P.S. I don\'t want to change system settings. I\'ve seen this one (HowTo Disable WebBrowser 'Click Sound' in your app only) but Document.Write is not an option for me. 回答1: For IE7 and above, you can use this: int feature = FEATURE_DISABLE_NAVIGATION_SOUNDS; CoInternetSetFeatureEnabled(feature, SET_FEATURE_ON_PROCESS, true); using the following DLL imports

How to use WebBrowser control DocumentCompleted event in C#?

风格不统一 提交于 2019-11-26 09:00:37
问题 Before starting writing this question, i was trying to solve following // 1. navigate to page // 2. wait until page is downloaded // 3. read and write some data from/to iframe // 4. submit (post) form The problem was, that if a iframe exists on a web page, DocumentCompleted event would get fired more then once (after each document has been completed). It was highly likely that program would have tried to read data from DOM that was not completed and naturally - fail. But suddenly while

Add new Microsoft Edge to web browser control?

匆匆过客 提交于 2019-11-26 08:21:19
问题 The new Windows 10 with Microsoft Edge has arrived. I want to ask you, how can I add it to my web browser control? I need it because the actual web browser control doesn\'t allow JavaScript and CSS3. I used to also add Chrome browser with the projects WebKit and Awesomium but they didn\'t remember the login credentials (I need them for my app) so I have to use I.E. unfortunately. 回答1: UPDATE May 2018: FINALLY Microsoft has made it easy. https://blogs.windows.com/msedgedev/2018/05/09/modern

The notorious yet unaswered issue of downloading a file when windows security is required

一世执手 提交于 2019-11-26 07:49:54
问题 There is a web site: http://site.domain.com which prompts for credentials with \"windows security\" dialog box. So I managed to use WebBrowser control to navigate to the page and send keystrokes to enter the password - I could not find another way around. Now I came to the point where the website generates a link to a file I want to download, it looks like: http://site.domain.com/operations/reporting/csv/Report720_2553217.csv I tried to use WebClient to download the file but it does nothing

Uploading Files Not Working - Need Assistance

送分小仙女□ 提交于 2019-11-26 07:48:45
问题 I am trying to upload a file (an image) using the WebBrowser control. Can\'t seem to do it and need some help. Here is the Html: <form action=\"https://post.testsite.com/k/IOkurrwY4xGI_EJMbjF5pg/zMNsR\" method=\"post\" enctype=\"multipart/form-data\"> <input type=\"hidden\" name=\"cryptedStepCheck\" value=\"U2FsdGVkX18yNzEwMjcxMJdrv2IidjtpGSCPzHNblWk02eJAJ6DFXFXic-Am1lTPMYL7k7XDoH0\"> <input type=\"hidden\" name=\"a\" value=\"add\"> <input class=\"file\" type=\"file\" name=\"file\" multiple=\

WebBrowser print settings

[亡魂溺海] 提交于 2019-11-26 07:48:39
问题 How ca i change my html document orientation(to Landscape) for printing using WebBrowser control. var browser = new WebBrowser(); browser.DocumentCompleted += (sender, args) => { var ws = sender as WebBrowser; //change paper size and orientation ws.Print(); }; browser.Navigate(path); I need to change paper size format to C5 and orientation to Landscape before printing. How can i do this without any dialogs? 回答1: To control HTML printing layout beyond @media CSS with WebBrowser (both WinForms

WPF WebBrowser control - how to suppress script errors?

泪湿孤枕 提交于 2019-11-26 07:29:13
I found a similar question here: How do I suppress script errors when using the WPF WebBrowser control? But non of those solutions work for me. I need to stop the popups from appearing as i am using the WebBrowser to automate admin tasks on a website. SuppressScriptErrors does not appear to be an available attribute on my WebControl :( Here is a C# routine that is capable of putting WPF's WebBrowser in silent mode. You can't call it at WebBrowser initialization as it 's too early, but instead after navigation occured. Here is a WPF sample app with a wbMain WebBrowser component: public partial

Is it possible to transfer authentication from Webbrowser to WebRequest

▼魔方 西西 提交于 2019-11-26 07:26:48
问题 I\'m using webbrowser control to login any site. And then i want to download some sub page html using WebRequest (or WebClient). This links must requires authentication. How to transfer Webbrowser authentication information to Webrequest or Webclient? 回答1: If the question is only "How to transfer Webbrowser authentication information to Webrequest or Webclient?" this code is enough: You can call the GetUriCookieContainer method that returns you a CookieContainer that can be used for