0

WebDriverProxyExamplesという名前の JimEvans のサンプル プロジェクトを使用しています。このプロジェクトは、FiddlerApplication と共に Selenium を使用します。これまでのところ、コードと応答コードで見たものに満足しています。しかし、AngularJsランディング ページの応答コードをキャプチャしようとすると、応答コードのキャプチャに失敗し、0 が返されます。

ここに画像の説明を入力

編集:デバッグに使用しようとしたコードの断片

SessionStateHandler responseHandler = delegate(Session targetSession)
{
    if (printDebugInfo)
    {
        Console.WriteLine("DEBUG: Received response for resource with URL {0}", targetSession.fullUrl);
    }

    if (targetSession.fullUrl == targetUrl)
    {
        responseCode = targetSession.oResponse.headers.HTTPResponseCode;
        Console.WriteLine(targetSession.oResponse.headers);
        if (printDebugInfo)
        {
            Console.WriteLine("DEBUG: Found response for {0}, setting response code.", targetSession.fullUrl);
        }
    }
};

// Attach the event handler, perform the navigation, and wait for
// the status code to be non-zero, or to timeout. Then detach the
// event handler and return the response code.
FiddlerApplication.AfterSessionComplete += responseHandler;
driver.Url = targetUrl;
while (responseCode == 0 && DateTime.Now < endTime)
{
    System.Threading.Thread.Sleep(100);
}

FiddlerApplication.AfterSessionComplete -= responseHandler;
return responseCode;
4

1 に答える 1

1

適切な証明書ジェネレーター (makecert.exe など) が適切な場所にないなど、いくつかの原因が考えられます。WebDriverProxyExample コードを変更して、表示用のエラー ハンドラーをフックする必要があります。

 Fiddler.FiddlerApplication.OnNotification += delegate(object sender, NotificationEventArgs oNEA) { Console.WriteLine("** NotifyUser: " + oNEA.NotifyString); };
 Fiddler.FiddlerApplication.Log.OnLogString += delegate(object sender, LogEventArgs oLEA) { Console.WriteLine("** LogString: " + oLEA.LogString); };
于 2015-04-10T16:45:55.553 に答える