chromium-embedded

How to trap/listen javascript function or events in cefsharp

孤街醉人 提交于 2019-12-02 01:58:33
I am trying to use cefSharp for a WPF application. I can find "how to call a Javascript methods from .Net . But is there a way where I can get notified for Javascript functions or events in .Net? e.g. if there is a Javascript function (with and without param) I can get the notification with or without values in .Net. In short, YES! There's bindings available for: c# -> js use webBrowser.ExecuteScriptAsync(script); js -> c# use webBrowser.RegisterJsObject(A_NAME_FROM_JS, objectToBind); Then from js you can call: window.A_NAME_FROM_JS.MethodOnObj() and this will invoke the MethodOnObj() on the

Delphi Chromium - Iterate DOM

假装没事ソ 提交于 2019-12-01 09:01:40
I'm trying to iterate the DOM using TChromium and because i use Delphi 2007 i can't use anonymous methods, so i created a class inherited of TCEFDomVisitorOwn. My code is as below, but for some reason the 'visit' procedure is never called, so nothings happens. unit udomprinc; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ceflib, cefvcl; type TForm1 = class(TForm) Chromium1: TChromium; procedure FormCreate(Sender: TObject); procedure Chromium1LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer)

CefSharp WinForms Web Browser Won't Display

女生的网名这么多〃 提交于 2019-12-01 00:44:05
I have a dead simple example trying to get the CEF Browser to append on a Winforms Form. For some reason it won't display. public partial class Form1 : Form { public Form1() { InitializeComponent(); CefSharp.WinForms.ChromiumWebBrowser test = new CefSharp.WinForms.ChromiumWebBrowser("http://google.com"); this.Controls.Add(test); } } Below is the VS Solution I am using. I added the package via Nuget Your code above is a bit too dead simple :) It's missing a call to Cef.Initialize() See the Main() method of the CefSharp.MinimalExample.WinForms example for a working example and further details on

Setting up CEF development in Eclipse for Java?

℡╲_俬逩灬. 提交于 2019-11-30 21:18:16
问题 I m new to this framework. I m facing problem in setting up development environment for CEF in eclipse. I want to embed chromium in Java application. I have searched a lot, but there is no proper tutorial or steps which shows how to do it. Can anyone please guide me through this? or at-least provide me with reliable guide, docs. on how to? I m not able to setup/build using eclipse. 回答1: For simple Java application build. Follow these steps and add jar as external references. How to integrate

CefSharp WinForms Web Browser Won't Display

允我心安 提交于 2019-11-30 19:16:22
问题 I have a dead simple example trying to get the CEF Browser to append on a Winforms Form. For some reason it won't display. public partial class Form1 : Form { public Form1() { InitializeComponent(); CefSharp.WinForms.ChromiumWebBrowser test = new CefSharp.WinForms.ChromiumWebBrowser("http://google.com"); this.Controls.Add(test); } } Below is the VS Solution I am using. I added the package via Nuget 回答1: Your code above is a bit too dead simple :) It's missing a call to Cef.Initialize() See

Cefsharp winforms: Inject jquery into page

那年仲夏 提交于 2019-11-30 15:54:29
I'm using ChromiumWebBrowser to load a website, and after page loaded, I'll execute some script browser.ExecuteScriptAsync(script) But that website not use jquery, so difficult to code my script. I want to inject jquery into that site to write my script easier. How can I do it? Thank you very much EDIT: I have had a jquery file in my computer. And I would like to add it to the page where I want to crawl data. I tried using LoadingStateChanged event, but not worked. private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e) { ChromiumWebBrowser browser =

CEF Simulate Mousedown and Keysend

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 15:49:23
I want to use CEF to control a Flash Application, so I need to simulate MouseDown and KeySend without JavaScript. I am using offscreen rendering. This is what I tried: managedCefBrowserAdapter.OnMouseButton( 500, 500, 0, true, 2, CefEventFlags.LeftMouseButton); or MouseEvent a = new MouseEvent(); a.Modifiers = CefEventFlags.LeftMouseButton; a.X = 500; a.Y = 500; or managedCefBrowserAdapter.SendKeyEvent(0, 0, 0); But nothing works. This code works for me. Clicks once on the position 0, 0 (left-upper corner) browser.GetBrowser().GetHost().SendMouseClickEvent(0, 0, MouseButtonType.Left, false, 1,

Sending information from Chromium Embedded (Javascript) to a containing C++ application

元气小坏坏 提交于 2019-11-30 12:47:25
After checking out the Chromium Embedded Framework example I have a question. I need native interaction with the embedded part of my window. However, in the CEF example, all I saw was the c++ sending messages to the browser, not the other way around. I was wondering if there is any way to send a message from JavaScript from c++, like in the way of a function. What I am looking for is something like this. I have a button in my webpage that when clicked. I would like to minimize the window. Is there any way to call some c++ from JavaScript in CEF? Easiest way: 1. In main process (UI process) -

Debugging JavaScript in Chromium Embedded Framework

房东的猫 提交于 2019-11-30 06:18:52
I have a WPF application which uses CEF to display web content. My question is, is there a way to debug the Javascript/Web parts inside a WPF application? Enable remote debugging in your application: C# (CefSharp) CefSettings.RemoteDebuggingPort = 8088; C++ CefSettings settings; settings.remote_debugging_port = 8088; then run your app and point your browser to http://localhost:8088/ to access the Chromium developer console (the same you have in Chrome with Ctrl+Shift+j ) You may also use ShowDevTools() extension method ( source ) ChromiumWebBrowser browser = new ChromiumWebBrowser(); browser

Cefsharp winforms: Inject jquery into page

谁都会走 提交于 2019-11-29 22:50:55
问题 I'm using ChromiumWebBrowser to load a website, and after page loaded, I'll execute some script browser.ExecuteScriptAsync(script) But that website not use jquery, so difficult to code my script. I want to inject jquery into that site to write my script easier. How can I do it? Thank you very much EDIT: I have had a jquery file in my computer. And I would like to add it to the page where I want to crawl data. I tried using LoadingStateChanged event, but not worked. private void Browser