webbrowser-control

'JSON' is undefined

纵然是瞬间 提交于 2019-12-01 08:33:53
I'm trying to load the Chromecast background website into a c# WebBrowser but am getting: I assumed it was happening because the webbrowser is using IE7 by default(?) which might not play well with the JS in the website. I tried to updated the registery FEATURE_BROWSER_EMULATION to 9000 hoping force the webbrowser to use IE9 framework. But I still get the same errors. Is the webbrowser to basic for this task or is there a way around this problem? EDIT: So when I print the webbrowser.version I get: Version: 11.0.9600.16518. Which is the current version of IE I have. If I open IE11 and navigate

Web Scraping with WebBrowser and Single Thread Apartment C#

人走茶凉 提交于 2019-12-01 08:27:20
问题 This is a question about a slight variation on Noseratio's code in this question: [link]How to cancel Task await after a timeout period I am able to build his code exactly as-is to create a Console application that returns the URL and OuterHtml of each of the three web pages specified in the code. However, when I put the same code in a WinForms application, the only output I get is URL: http://example.com That means that the code does not display the OuterHtml of the first page, and it does

Windows forms web browser control zoom level

别来无恙 提交于 2019-12-01 07:41:50
I'm using a web browser control to display some on-the-fly generated HTML documents in my application. Problem is, on my machine said documents are displayed kinda zoomed in. On other colleagues' computers, everything looks "normal". It has to be some kind of local setting but I can't find where to change it. I can CTRL + Scroll wheel to zoom out, but zoom level is not retained. As far as I can see, there's no easy way to set the predefined zoom level programmatically. It may be a long shot but I fear it has something to do with Internet Explorer (which I never use) and its settings. Changing

Get XPath from clicked HtmlElement in WebBrowserControl

大城市里の小女人 提交于 2019-12-01 07:12:16
问题 How can I get the XPath from a clicked HtmlElement in the WebBrowserControl? This is how I retrieve the clicked HtmlElement: System.Windows.Forms.HtmlDocument document = this.webBrowser1.Document; document.MouseUp += new HtmlElementEventHandler(this.htmlDocument_Click); private void htmlDocument_Click(object sender, HtmlElementEventArgs e) { HtmlElement element = this.webBrowser1.Document.GetElementFromPoint(e.ClientMousePosition); } I want to click specific elements (price, article number,

How to get HTML textbox value?

两盒软妹~` 提交于 2019-12-01 07:10:32
问题 I am trying to get values of few textboxes on a website in a C# WinForms app. It is input type text, set to readonly, but when I try to read it in my app using string price = webBrowser1.Document.GetElementById("price").GetAttribute("value"); it returns an empty string. When I try to set some other (not readonly) input value using .SetAttribute("value", "testValue") , it works just fine. Anyone could help me with this please? 回答1: Unfortunately the value from the text box cannot be retrieved

Local HTML File - WebBrowser - Windows phone 7

只愿长相守 提交于 2019-12-01 06:49:13
问题 I need help in displaying HTML File in webbrowser in Windows phone 7 app. I've an html file in my wpf-silverlight project as resource. Now When the user click on Help button in my App, i need to display this HTML in webbrowser. Here is the code, which is giving me an error - webBrowser1.Navigate(new Uri("AppHelp.html",UriKind.Relative)) But, if i use this code, It's loading fine webBrowser1.Navigate(new Uri("http://mywebsite.com/AppHelp.html",UriKind.Relative)) Please help! I've change code

How can I confirm script error dialog box into WebBrowser?

此生再无相见时 提交于 2019-12-01 06:47:02
I need to confirm programatically (i.e, answer 'yes') to a script error dialog box into WebBrowser otherwise the page will stop working. I have no code to show because I have no idea how I could do this. Here's a image from dialog box I'm talking about: (take from this , btw) According to the "How to handle script errors as a WebBrowser control host" MSKB article, you need to handle CGID_DocHostCommandHandler / OLECMDID_SHOWSCRIPTERROR command in the WebBrowser host. With a bit of coding, here is how it can be done for the WinForms WebBrowser version, and it actually works: using System; using

Web Browser to handle pop ups within the application

送分小仙女□ 提交于 2019-12-01 06:45:19
I am trying to use the WebBrowser control to launch a new form for popups instead of it opening in IE. I have tried to use the AxWebBrowser instead to get the popups which works with NewWindow3 event and just doing e.ppDisp = AxWebBrowser.Application , but there are many limitations that come with AxWebBrowser. So instead I am trying to Extend the normal WebBrowser to include the NewWindow3 event like the AxWebBrowser but running into problems. With e.ppDisp = AxWebBrowser.Application I am getting errors: "InvalidVariant was detected" followed by "Specified OLE variant is invalid" if I

How to navigate in a list of links using webbrowser?

眉间皱痕 提交于 2019-12-01 05:57:55
I have a list of url and I need to navigate them. How can I make sure that every url will call the DocumentCompleted event ? I've already tried to create many threads and tried using a single thread too but the app is still not firing the event DocumentCompleted for each url. Is there a way to make a loop in a list of urls and make them call a DocumentCompleted until the thread calls the next url ? noseratio To implement this, async/await and Task Parallel Library may come in handy. They allow to have familiar, pseudo-linear code flow for what is an asynchronous logic (handling

WPF webbrowser control vs winforms

可紊 提交于 2019-12-01 05:54:54
I am creating a wpf application where I am using a webbrowser control. anyways sometimes I am required to look for html elements, invoke clicks, and other basic functionality. In winforms webbrowser control I am able to achieve this by doing: webBrowser1.Document.GetElementById("someId").SetAttribute("value", "I change the value"); In wpf webbrowser control I managed to achieve the same thing by doing: dynamic d = webBrowser1.Document; var el = d.GetElementById("someId").SetAttribute("value", "I change the value"); I also managed to invoke a click in the wpf webbrowser control by using the