Home > front end >  How to implement the console of chrome in the program run result
How to implement the console of chrome in the program run result

Time:12-01

I have generated A footlocker site cookies js code A cookie js code (output), open the footlocker website (chrome), F12, bring up the console, paste into, enter, can run normally occur as A result, if in the baidu website F12 bring up the console running, cross-domain mistakes,
Now want to use python code to implement this process get cookies, use jsdom (s has a window in the code, document and other variables, involves to the window. The innerWidth, document. The body. The clientWidth, window. XDomainRequest, navigator, etc.)
 import execjs 

Js="'
Jsdom const jsdom=the require (" ");
Const {JSDOM}=JSDOM;
Const dom=new JSDOM (` & lt; ! DOCTYPE html>

Hello world

`);
The window=dom. The window;
The document=window. The document;
XMLHttpRequest=window. The XMLHttpRequest;

The function getCookie () {
//output cookie js code A
Return the cookie;
}
} "'
P=execjs.com running (js, CWD=r './node_modules')
Print p.c all (' getCookie

Running can't obtain the result, the returned is None, whether is also the problem of the cross domain? Consult the what to do?
  • Related