【问题标题】:Sending POST Requests in Watin在 Watin 中发送 POST 请求
【发布时间】:2014-07-06 15:02:25
【问题描述】:

我正在尝试使用基本身份验证在网页上发送 POST 请求。那么是否有任何示例显示如何在 Watin 中自动发送 POST 请求

【问题讨论】:

    标签: post automation request http-post watin


    【解决方案1】:

    我发现this post 有效

    IE _ie = new IE();
    object flags = null;
    object targetFrame = null;
    object headers = "Content-Type: application/x-www-form-urlencoded" + Convert.ToChar(10) + Convert.ToChar(13);
    object postDataBytes = ASCIIEncoding.ASCII.GetBytes("{ mydata: 5 }");
    object resourceLocator = "http://google.com";
    IWebBrowser2 browser = (IWebBrowser2)_ie.InternetExplorer;
    browser.Navigate2(ref resourceLocator, ref flags, ref targetFrame, ref postDataBytes, ref headers);
    _ie.WaitForComplete();
    

    我的文档是一个 json 响应,我仍在努力通过 WatiN 访问其原始内容 - 目前正在提示下载。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-20
      • 2011-03-20
      • 1970-01-01
      • 2019-01-13
      相关资源
      最近更新 更多