chrome platform

folder_extension:

---menifest.json

---navigator_change.js

manifest.json

{
    "manifest_version": 2,
    "content_scripts": [ {
        "js":        [ "navigator_change.js" ],
        "matches":   [ "<all_urls>"],
        "run_at":    "document_start"
    } ],
    "converted_from_user_script": true,
    "description":  "Fake navigator.platform",
    "name":         "Android",
    "version":      "1"
}

  

navigator_change.js

var codeToInject = 'Object.defineProperty(navigator,"platform", { 
  get: function () { return "Android"; }, 
  set: function (a) {} 
 });';
var script = document.createElement('script');
script.appendChild(document.createTextNode(codeToInject));
(document.head || document.documentElement).appendChild(script);
script.parentNode.removeChild(script);

  

reference:

https://stackoverflow.com/questions/38808968/change-navigator-platform-on-chrome-firefox-or-ie-to-test-os-detection-code

https://stackoverflow.com/questions/9515704/insert-code-into-the-page-context-using-a-content-script

https://blog.csdn.net/lovedingd/article/details/81671920

https://blog.csdn.net/weixin_42244754/article/details/81541894

https://stackoverflow.com/questions/45372066/is-it-possible-to-run-google-chrome-in-headless-mode-with-extensions

  

http://chromedriver.storage.googleapis.com/index.html

chromedriver版本支持的Chrome版本
v2.41 v67-69
v2.40 v66-68
v2.39 v66-68
v2.38 v65-67
v2.37 v64-66
v2.36 v63-65
v2.35 v62-64
v2.34 v61-63
v2.33 v60-62
v2.32 v59-61
v2.31 v58-60
v2.30 v58-60
v2.29 v56-58
v2.28 v55-57
v2.27 v54-56
v2.26 v53-55
v2.25 v53-55
v2.24 v52-54
v2.23 v51-53
v2.22 v49-52
v2.21 v46-50
v2.20 v43-48
v2.19 v43-47
v2.18 v43-46
v2.17 v42-43
v2.13 v42-45
v2.15 v40-43
v2.14 v39-42
v2.13 v38-41
v2.12 v36-40
v2.11 v36-40
v2.10 v33-36
v2.9 v31-34
v2.8 v30-33
v2.7 v30-33
v2.6 v29-32
v2.5 v29-32
v2.4

v29-32

原文地址:https://www.cnblogs.com/pythonClub/p/10446780.html