【问题标题】:How to save captcha image in Gecko web browser c#如何在 Gecko Web 浏览器 c# 中保存验证码图像
【发布时间】:2016-11-14 01:09:36
【问题描述】:

我正在尝试使用 C# 为浏览器游戏创建机器人,但我必须使用 Gecko 网络浏览器。

游戏登录页面有验证码,如果我打开图片链接,验证码会改变。所以我需要将验证码图像保存在磁盘上并在图片框中使用它,但我不知道如何。

验证码图片没有任何名称或id标签,来源是:code.php?938080。

我找到了Catching captcha image,但我不知道如何为我的案例和 Gecko 转换它。

foreach (HtmlElement img in wb.Document.Images)
{

    isitcaptcha = img.OuterHtml.IndexOf("Captcha", 0);
    if (isitcaptcha > 0)
    {
        captchaimg = img.OuterHtml.ToString();

上面写着:

Cannot convert type 'Gecko.GeckoHtmlElement' to 'System.Windows.Forms.HtmlElement'

The name 'isitcaptcha' does not exist in the current context    

The name 'captchaimg' does not exist in the current context 

【问题讨论】:

  • 为什么要标记 php?
  • 推荐标签! idk 也许有帮助
  • 建议的标签是自动的,您可以根据需要添加/删除。

标签: c# captcha gecko


【解决方案1】:

在我看来,您应该使用 Gecko.DOM 命名空间的 GeckoHtmlElement 对象。 并声明你的变量...

foreach (GeckoHtmlElement img in wb.Document.Images)
{

var isitcaptcha = img.OuterHtml.IndexOf("Captcha", 0);
if (isitcaptcha > 0)
{
    var captchaimg = img.OuterHtml.ToString();

【讨论】:

    猜你喜欢
    • 2016-09-10
    • 2016-01-28
    • 2017-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多