CefSharp.WinForms.ChromiumWebBrowserExtensions
83.4.20
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package CefSharp.WinForms.ChromiumWebBrowserExtensions --version 83.4.20
NuGet\Install-Package CefSharp.WinForms.ChromiumWebBrowserExtensions -Version 83.4.20
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="83.4.20" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CefSharp.WinForms.ChromiumWebBrowserExtensions --version 83.4.20
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CefSharp.WinForms.ChromiumWebBrowserExtensions, 83.4.20"
#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=83.4.20 // Install CefSharp.WinForms.ChromiumWebBrowserExtensions as a Cake Tool #tool nuget:?package=CefSharp.WinForms.ChromiumWebBrowserExtensions&version=83.4.20
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
主要功能
类库基于
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)
,触发input
和change
事件,适配React框架,文本框不再被清空。 - 重写
MyRequestHandler
,通过ChangeDataItems
、RedirectItems
修改响应返回值或者重定向
63.0.3.1
- 重写
MyRequestHandler
,通过ChangeResponseBodyItems
、ChangeRequestItems
修改响应返回值或者重定向 - 优化
ExSetValue
,添加等待文本框存在、文本框存在后延时、赋值后延时 - 优化
ExClick
,添加等待按钮存在、按钮存在后延时、点击后延时 - 优化文件结构,将
ChromiumWebBrowserExtensions.cs
拆分为多个文件 - 添加
ProxyExtensions
运行时动态设置代理 - 添加
CookieExtensions
删除Cookies
63.0.3.2
- 修复
ExClick
点击后不延时 - 优化
MyRequestHandler
默认初始化ChangeResponseBodyItems
、ChangeRequestItems
,通过Add
函数添加操作
63.0.3.3
- 添加
ExLoadAsync
加载网页并等待页面加载完成 - 优化
ExWaitForLoadEnd
63.0.3.4
- 新增
MyRequestHandler
的ProxyUsername
和ProxyPassword
,用于设置代理用户名和密码,默认不启用:ProxyUsername
为null
- 优化
ExLoadAsync
,添加页面元素判断,用于判断网页是否加载成功
63.0.3.5
- 优化
ExLoadAsync
,添加运行日志
83.4.20
- 匹配
CefSharp
83.4.20版本
Product | Versions 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.
-
.NETFramework 4.6
- CefSharp.WinForms (>= 83.4.20)
- Sayaka.Common (>= 1.0.20)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
CefSharp.WinForms.ChromiumWebBrowserExtensions