CefSharp.WinForms.ChromiumWebBrowserExtensions 63.0.3.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package CefSharp.WinForms.ChromiumWebBrowserExtensions --version 63.0.3.4                
NuGet\Install-Package CefSharp.WinForms.ChromiumWebBrowserExtensions -Version 63.0.3.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CefSharp.WinForms.ChromiumWebBrowserExtensions" Version="63.0.3.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CefSharp.WinForms.ChromiumWebBrowserExtensions --version 63.0.3.4                
#r "nuget: CefSharp.WinForms.ChromiumWebBrowserExtensions, 63.0.3.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CefSharp.WinForms.ChromiumWebBrowserExtensions as a Cake Addin
#addin nuget:?package=CefSharp.WinForms.ChromiumWebBrowserExtensions&version=63.0.3.4

// Install CefSharp.WinForms.ChromiumWebBrowserExtensions as a Cake Tool
#tool nuget:?package=CefSharp.WinForms.ChromiumWebBrowserExtensions&version=63.0.3.4                

主要功能

  • 类库基于CefSharp.WinForms,纯C#开发,主要是对public static Task<JavascriptResponse> EvaluateScriptAsync(this ChromiumWebBrowser browser,string script,TimeSpan? timeout = null)进行常用js方法扩展,封装在CefSharp.WinForms.ChromiumWebBrowserExtensions命名空间下,通过var value = await browser.ExGetValue("div.number", 0);调用,可以快速获取和指定指定节点的类、文本、属性等值,模拟鼠标点击、拖放等,节点通过css选择器进行选择。

  • 初始化:

      private void InitBrowser()
      {
          if (browser == null)
          {
              CefSharpSettings.ShutdownOnExit = true;
              var settings = new CefSettings();
              settings.Locale = "zh-CN";
              Cef.Initialize(settings);
              browser = new ChromiumWebBrowser(HomePageUrl);
              var changeResponseBodyItems = new List<IChangeResponseBody>();
              var changeRequestItems = new List<IChangeRequest>();
              browser.RequestHandler = new MyRequestHandler
              {
                  ChangeResponseBodyItems = changeResponseBodyItems,
                  ChangeRequestItems = changeRequestItems
              };
              browser.RequestContext = new RequestContext();
              browser.KeyboardHandler = new MyKeyBoardHander();
              browser.JsDialogHandler = new MyJsDialogHandler(false);
              browser.LifeSpanHandler = new MyLifeSpanHandler();
              browser.FrameLoadEnd += (sender, args) =>
              {
                  if (args.Frame.IsMain)
                  {
                  }
              };
              panel1.Controls.Add(browser);
              browser.Dock = DockStyle.Fill;
          }
      }
    

1.0.0

  • 命名空间为CefSharp.WinForms.ChromiumWebBrowserExtensions
  • 通过扩展函数调用,如var value = await browser.ExGetValue("div.number", 0);

63.0.3

  • 匹配CefSharp 63.0.3版本号

优化

  • 优化public static async Task<bool> ExSetValue(this ChromiumWebBrowser browser, string cssSelector, int index, string value),触发inputchange事件,适配React框架,文本框不再被清空。
  • 重写MyRequestHandler,通过ChangeDataItemsRedirectItems修改响应返回值或者重定向

63.0.3.1

  • 重写MyRequestHandler,通过ChangeResponseBodyItemsChangeRequestItems修改响应返回值或者重定向
  • 优化ExSetValue,添加等待文本框存在、文本框存在后延时、赋值后延时
  • 优化ExClick,添加等待按钮存在、按钮存在后延时、点击后延时
  • 优化文件结构,将ChromiumWebBrowserExtensions.cs拆分为多个文件
  • 添加ProxyExtensions运行时动态设置代理
  • 添加CookieExtensions删除Cookies

63.0.3.2

  • 修复ExClick点击后不延时
  • 优化MyRequestHandler默认初始化ChangeResponseBodyItemsChangeRequestItems,通过Add函数添加操作

63.0.3.3

  • 添加ExLoadAsync加载网页并等待页面加载完成
  • 优化ExWaitForLoadEnd

63.0.3.4

  • 新增MyRequestHandlerProxyUsernameProxyPassword,用于设置代理用户名和密码,默认不启用:ProxyUsernamenull
  • 优化ExLoadAsync,添加页面元素判断,用于判断网页是否加载成功
Product Compatible and additional computed target framework versions.
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
83.4.20.2 2,302 11/27/2021
83.4.20.1 695 11/20/2021
83.4.20 800 6/3/2021
63.0.3.5 426 4/28/2021
63.0.3.4 408 4/24/2021
63.0.3.3 377 4/23/2021
63.0.3.2 429 4/21/2021

CefSharp.WinForms.ChromiumWebBrowserExtensions