[HtmlUnit] Hi! Problem with cookie
Adriano Oliveira da Silva <[email protected]> Fri, 18 Nov 2022 16:25:51 -0300
| Newsgroups | gmane.comp.java.htmlunit.devel |
|---|---|
| Message-ID | <CAEsDW-mLVoSyXxFoEHs-JP0jXD-aj8NYinyKvtwBdvK5WkUC1g@mail.gmail.com> |
--===============1104504718462085338==
Content-Type: multipart/alternative; boundary="0000000000000fff1805edc3ad19"
--0000000000000fff1805edc3ad19
Content-Type: text/plain; charset="UTF-8"
Hello,
I am try get page with htmlunit (all versions htmlunit, all BrowserVersion)
and the site return problem with cookie. As if it were disabled.
sample code:
WebClient webClient = new WebClient(BrowserVersion.BEST_SUPPORTED);
webClient.getCookieManager().setCookiesEnabled(true);
HtmlPage page = webClient.getPage("
https://sso.acesso.gov.br/logn?client_id=consumidor.gov.br&authorization_id=1848bfae21b
");
System.out.println(page.asNormalizedText());
show message
"Foi detectado que os cookies do seu browser podem estar
desabilitados. Por favor habilite os cookies e tente novamente."
Does it have a solution?
Thank you
--0000000000000fff1805edc3ad19
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hello,<div><br></div><div>I am try get page with htmlunit =
(all versions htmlunit, all=C2=A0<span style=3D"color:rgb(0,0,0);font-famil=
y:"JetBrains Mono",monospace">BrowserVersion</span>) and the site=
return problem with cookie.=C2=A0As if it were disabled.</div><div><br></d=
iv><div>sample code:</div><div><pre style=3D"color:rgb(0,0,0);font-family:&=
quot;JetBrains Mono",monospace">WebClient webClient =3D <span style=3D=
"color:rgb(0,0,128);font-weight:bold">new </span>WebClient<span style=3D"co=
lor:rgb(102,14,122);font-weight:bold;font-style:italic">(</span>BrowserVers=
ion.BEST_SUPPORTED);</pre><pre style=3D"color:rgb(0,0,0);font-family:"=
JetBrains Mono",monospace"><pre style=3D"font-family:"JetBrains M=
ono",monospace">webClient.getCookieManager<span style=3D"color:rgb(102=
,14,122);font-weight:bold;font-style:italic">()</span>.setCookiesEnabled<sp=
an style=3D"color:rgb(102,14,122);font-weight:bold;font-style:italic">(</sp=
an><span style=3D"color:rgb(0,0,128);font-weight:bold">true</span><span sty=
le=3D"color:rgb(102,14,122);font-weight:bold;font-style:italic">)</span>;<b=
r></pre>HtmlPage page =3D webClient.getPage<span style=3D"color:rgb(102,14,=
122);font-weight:bold;font-style:italic">(</span><span style=3D"color:rgb(0=
,128,0);font-weight:bold">"<a href=3D"https://sso.acesso.gov.br/logn?c=
lient_id=3Dconsumidor.gov.br&authorization_id=3D1848bfae21b">https://ss=
o.acesso.gov.br/logn?client_id=3Dconsumidor.gov.br&authorization_id=3D1=
848bfae21b</a>"</span><span style=3D"color:rgb(102,14,122);font-weight=
:bold;font-style:italic">)</span>;
</pre><pre style=3D"color:rgb(0,0,0);font-family:"JetBrains Mono"=
,monospace">System.<span style=3D"color:rgb(102,14,122);font-weight:bold;fo=
nt-style:italic">out</span>.println<span style=3D"color:rgb(102,14,122);fon=
t-weight:bold;font-style:italic">(</span>page.asNormalizedText<span style=
=3D"color:rgb(102,14,122);font-weight:bold;font-style:italic">())</span>;</=
pre><pre style=3D"color:rgb(0,0,0);font-family:"JetBrains Mono",m=
onospace">show message=20
"Foi detectado que os cookies do seu browser podem estar desabilitados=
. Por favor habilite os cookies e tente novamente."</pre><pre style=3D=
"color:rgb(0,0,0);font-family:"JetBrains Mono",monospace">Does it=
have a solution?<br><br>Thank you<br></pre><pre style=3D"color:rgb(0,0,0);=
font-family:"JetBrains Mono",monospace"><br></pre><pre style=3D"c=
olor:rgb(0,0,0);font-family:"JetBrains Mono",monospace"><br></pre=
><pre style=3D"color:rgb(0,0,0);font-family:"JetBrains Mono",mono=
space"><br></pre></div></div>
--0000000000000fff1805edc3ad19--
--===============1104504718462085338==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============1104504718462085338==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
HtmlUnit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
--===============1104504718462085338==--