Executing JavaScript Using CefSharp

Published on August 01, 2017
ExecutingJavaScriptHeader.jpg

JavaScript handles sufficient part of work with web pages’ content, allowing to access, modify, and interact with it. In this tutorial we’ll create a WPF application which can execute custom JavaScript on the web page.

First of all, we’ll need create a WPF project and add the CefSharp NuGet package to that project.

The next step is markup of the MainWindow. The source code of the MainWindow.xaml is provided below.

Now let’s implement the behavior of the MainWindow. The source code of the MainWindow.xaml.cs is provided below.

The application now can be built and launched. After the web page is loaded we can type the JavaScript code we need to be executed and press the “Execute” button.

Here’s what the result will look like:

image-title-here

Categories: Articles

Tags: JavaScript WPF