以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 怎样获取cookie值 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=169557) |
-- 作者:huangxueyao -- 发布时间:2021/6/20 22:39:00 -- 怎样获取cookie值 用WebBrowser登陆打开一个页面然后登陆账号后,怎样获取到对应的cookie值?? |
-- 作者:有点蓝 -- 发布时间:2021/6/20 23:01:00 -- https://docs.microsoft.com/zh-cn/dotnet/api/system.windows.forms.htmldocument.cookie?view=net-5.0#System_Windows_Forms_HtmlDocument_Cookie Dim web As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")basecontrol dim s as string = web.Document.Cookie msgbox(s)
|
-- 作者:huangxueyao -- 发布时间:2021/6/20 23:04:00 -- --------------------------- 错误 --------------------------- 编译错误:“Document”不是“WinForm.WebBrowser”的成员。 错误代码:Dim s As String = web.Document.Cookie --------------------------- 确定 --------------------------- |
-- 作者:有点蓝 -- 发布时间:2021/6/20 23:07:00 -- Dim web= e.Form.Controls("WebBrowser1").basecontrol |
-- 作者:huangxueyao -- 发布时间:2021/6/20 23:12:00 -- https网址是否无法获取?用百度测试OK,用一个https网址测试获取到空值 |
-- 作者:有点蓝 -- 发布时间:2021/6/21 8:51:00 -- 我测试没有问题 Dim vw As WinForm.WebBrowser = Forms("窗口1").Controls("WebBrowser1") Dim web As System.Windows.Forms.WebBrowser = vw.basecontrol web.ScriptErrorsSuppressed = True vw.Address = "https://xxxx" Do Until web.ReadyState = 4 Application.DoEvents Loop Dim s As String = web.Document.Cookie msgbox(s) |