简体   繁体   English

如何使用 selenium python 从 chrome web 商店安装扩展

[英]how to install an extension from chrome web store using selenium python

I am trying to automate an action in this website, https://chocolia.eu/voter but i get blocked by cloudflare, it freezes the website and when i refresh it here is what it does:我正在尝试在此网站https://chocolia.eu/voter中自动执行一项操作,但我被 cloudflare 阻止,它冻结了网站,当我在这里刷新它时它的作用是: 图片

i can use undetected chrome driver for this situation and it works with it but i need an extension for this to work and undetected chrome driver is not compatible with extensions so i want to install it from chrome webstore but you have to confirm the installation of the extension and it is not a javascript alert as i tried driver.switch_to.alert.我可以在这种情况下使用未检测到的 chrome 驱动程序,它可以使用,但我需要一个扩展才能工作,并且未检测到的 chrome 驱动程序与扩展不兼容,所以我想从 chrome webstore 安装它,但你必须确认安装扩展,它不是 javascript 警报,因为我尝试了 driver.switch_to.alert。

You need to be undetected but U.C can't install extension, you should read the solution given by colossatr0n in this thread: Can a website detect when you are using Selenium with chromedriver?您需要未被检测到,但 U.C 无法安装扩展程序,您应该阅读 colossatr0n 在此线程中给出的解决方案: Can a website detect when you are using Selenium with chromedriver? Here is a partial copy of the response, the idee is to replace the cdc_ in chromedriver.exe to not be detected:这是响应的部分副本,想法是将chromedriver.exe中的cdc_替换为不被检测到:

The bot detection scripts usually look anything containing word "selenium" / "webdriver" in any of the variables (on window object), and also document variables called $cdc_ and $wdc_ . bot 检测脚本通常在任何变量(在 window 对象上)中查找包含单词“selenium”/“webdriver”的任何内容,并且还记录名为$cdc_$wdc_的变量。 This is the function I modified in chromedriver:这是我在chromedriver中修改的function:
File call_function.js:文件 call_function.js:

function getPageCache(opt_doc) {
  var doc = opt_doc || document;
  //var key = '$cdc_asdjflasutopfhvcZLmcfl_';
  var key = 'randomblabla_';
  if (!(key in doc))
    doc[key] = new Cache();
  return doc[key];
}

(Note the comment. All I did I turned $cdc_ to randomblabla_ .) (注意评论。我所做的就是把$cdc_变成randomblabla_ 。)

And finally i recommande you to replace $cdc_ by xxxx (same number of charactere) and modify it in HexEditor.最后,我建议您将$cdc_替换为xxxx (相同数量的字符)并在 HexEditor 中对其进行修改。 ( Moi aussi j'ai joué à chocolia.Mc avant add: l !'Magics#3537 ) ( Moi aussi j'ai joué à chocolia.Mc avant add: l !'Magics#3537 )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Selenium 和 Python 安装 Chrome 扩展 - How to install Chrome Extension using Selenium & Python 如何在所有浏览器配置文件中使用 Python 安装 Chrome 扩展程序? 硒 - How to install a Chrome extension with Python in all browser profiles? Selenium 使用 selenium 处理 Chrome Web 存储确认 window 在 ZA7F5F35426B9272117FC9231B56Z8 - Using selenium to handle Chrome Web Store confirmation window in Python 如何从 chrome web 商店中抓取给定扩展的评论? - How to scrape reviews from chrome web store for a given extension? Selenium :: Python :: Chrome扩展 - Selenium :: Python :: Chrome Extension 如何在 Z23EEEB4347BDD755BFC6B7EE9A 中使用 selenium firefox 和 chrome 驱动程序翻译 web 页面? - How to translate a web page using selenium firefox and chrome driver in python? 如何最好地为 python selenium chrome 安装代理 - How best to install a proxy for python selenium chrome Python Selenium 如何处理 Chrome 商店警报? - Python Selenium How to handle chrome store alert? 使用 Google Chrome 扩展的 Web Scraping Python - Web Scraping Python using Google Chrome extension 使用 python selenium 将广告拦截器扩展与无头 chrome 驱动程序一起使用 - Using an adblocker extension with the headless chrome driver using python selenium
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM