调查 C# 的 PhantomJSDriver。我发现了一个问题:当我尝试单击调用文件保存对话框的元素时 - PhantomJSDriver 抛出异常:
错误消息 => '单击成功但加载失败。状态:'失败''
由 Request => {"headers":{"Accept":"application/json, image/png","Connection":"Close","Content-Length":"0","Content-Type":" 引起application/json;charset=utf-8","Host":"localhost:34660"},"httpVersion":"1.1","method":"POST","post":"","url":" /click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative ":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/8839b140-08d7-11e3 -9482-fda3a2d41a6f/element/%3Awdc%3A1376920756991/click"}
PhantomJSDriver 是否有任何选项可以处理文件保存?
C#代码:
var dr = new PhantomJSDriver();
dr.Navigate().GoToUrl(" http://www.mywebapps.com/Default.aspx ");
var link = dr.FindElementByXPath("//a[@href='Setup.exe']");
链接.点击();