Closed Kenith closed 6 years ago
I tried set the cookie before go to url, still not working.
const Chromy = require('chromy')
let chromy = new Chromy({visible: true})
chromy.chain()
.setCookie({name: 'login-token', value: 'e0fe93d7-a26f-41cb-b0a3-6357c5310324%3a94d1709c-8682-4cc9-abfb-988ec6d33481_57b75423e7254e5a%3acrx.default'})
.goto('http://example.com')
.end()
.catch(e => console.log(e))
Done
const Chromy = require('chromy')
const DOMAIN = 'http://example.com';
const DOMAIN_PATH = DOMAIN + '/';
const COOKIES = [
{
"url": DOMAIN,
"expirationDate": 1528614000,
"hostOnly": false,
"httpOnly": false,
"name": "test2",
"sameSite": "no_restriction",
"secure": false,
"session": false,
"storeId": "0",
"value": "XYZ",
"id": 1000
},
{
"url": DOMAIN,
"expirationDate": 1528614000,
"hostOnly": false,
"httpOnly": false,
"name": "test",
"sameSite": "no_restriction",
"secure": false,
"session": false,
"storeId": "0",
"value": "ABCDE",
"id": 1001
},
{
"url": DOMAIN,
"expirationDate": 1528614000,
"hostOnly": false,
"httpOnly": false,
"name": "test3",
"sameSite": "no_restriction",
"secure": false,
"session": false,
"storeId": "0",
"value": "FOO",
"id": 1001
},
{
"url": DOMAIN,
"expirationDate": 1528614000,
"hostOnly": false,
"httpOnly": false,
"name": "login-token",
"sameSite": "no_restriction",
"secure": false,
"session": false,
"storeId": "0",
"value": "e0fe93d7-a26f-41cb-b0a3-6357c5310324%3a94d1709c-8682-4cc9-abfb-988ec6d33481_57b75423e7254e5a%3acrx.default",
"id": 1001
}
]
let chromy = new Chromy({visible: true})
var chromyChain = chromy.chain();
COOKIES.forEach((cookie) => {
chromyChain.setCookie(cookie);
})
chromyChain
.goto('http://exaple.com')
.end()
.catch(e => console.log(e))
closed the issue as solution found
Hello All,
We need to access the url directly without login by pass the cookie. We tried the following. Not working. Any ideas?
Thank you, Ken