【问题标题】:Click button on html page fetched using HttpWebResponse单击使用 HttpWebResponse 获取的 html 页面上的按钮
【发布时间】:2012-09-03 07:49:05
【问题描述】:

我这样在整个 HttpWebResponse 中有一个 html 页面:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(sslServerHost);
response = (HttpWebResponse)request.GetResponse();

当我在浏览器中访问相同的 URL 时,我会看到一个带有两个按钮的页面。我需要点击其中之一:

<form id="confirmationForm" name="confirmationForm" action="/oauth/oauth/authorize"
                  method="post">
     <input name="user_oauth_approval" value="true" type="hidden"/>
     <button name="authorize" type="submit" class="allow-button">
          Allow access
     </button>
</form>

如何使用我得到的 HttpWebResponse 以编程方式单击名称为“授权”的按钮?

【问题讨论】:

    标签: c# html httpwebresponse


    【解决方案1】:

    解决此问题的最简单方法是在 Web 浏览器中加载页面,并使用 HTTP 代理(如 Fiddler)运行,然后单击按钮并查看响应。将其复制出来,然后将其用于单击按钮的请求。

    【讨论】:

      猜你喜欢
      • 2019-12-16
      • 2020-07-20
      • 2020-04-28
      • 1970-01-01
      • 2014-09-10
      • 2022-11-23
      • 2020-10-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多