[英]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.