c - 如何使用 DotNetBrowser 捕获验证码图像对象
问题描述
我们在 DotNetBrowser 上显示的网站包含验证码图像元素。在代码元素中捕获此元素图像类型的方法是什么?
网址:https ://paydas.its.gov.tr/hesap_yonetimi/giris
browserView = new WinFormsBrowserView(BrowserFactory.Create(BrowserType.LIGHTWEIGHT));
//...
browserView.Browser.SetSize(1024, 768);
Bitmap screenshot = browserView.Browser.ImageProvider.GetImage() as Bitmap;
DOMElement captchaElement = browserView.Browser.GetDocument().GetElementById("imgCaptcha");
pictureBox1.Image = screenshot?.Clone(captchaElement.BoundingClientRect, screenshot.PixelFormat);
这种方法不健康。
解决方案
我找到了解决方案。
在创建 Browser 对象后,我添加了以下代码片段。
int viewHeight = 20000;
string[] switches = {
"--disable-gpu",
"--max-texture-size=" + viewHeight
};
BrowserPreferences.SetChromiumSwitches(switches);
推荐阅读
- python - 在 Python pandas 数据框中添加计数器作为附加列
- python - 将浮点数列表作为列添加到数据框时,我会丢失小数
- java - How can I set the radiobutton selection with my method btnCalcularOnClick()?
- codenameone - When videos are just loaded or paused, they are completely black (on Android)
- javascript - React-router-dom v6, URL changing but component doesn't render
- java - 如何根据用户的输入创建“自动”矩阵?
- json - How to show user profile photo in sharepoint view formatting?
- linux - EPOLLONESHOT 是否保证只唤醒一个线程?
- php - 如何使用 PHP 远程访问在 Windows Server 上运行的 localhost 应用程序?
- android - PubNub - 消息以推送和实时方式接收 [Android]