简体   繁体   English

检测到带有Chromedriver的Python Selenium

[英]Python Selenium with Chromedriver Detected

Having an issue signing in to the soundcloud website when using selenium with chromedriver. 将硒与chromedriver一起使用时,登录Soundcloud网站时出现问题。 Selenium is detected before I can even log in. 甚至在我登录之前就已检测到硒。

Hoping to find a solution to this, so that I can lightly automate the use of soundcloud. 希望找到一个解决方案,以便我可以轻松实现Soundcloud的自动化。

I have done hex editing of chromedriver to change the $cdc_ variables to random letters, thinking that this would make me less likely to get detected. 我已经对chromedriver进行了十六进制编辑,将$ cdc_变量更改为随机字母,以为这将使我不太可能被检测到。 I have also implemented proxy servers. 我还实现了代理服务器。 Obviously the proxy IP that I put in the code example is not the actual IP for what I am using. 显然,我在代码示例中放入的代理IP不是我正在使用的实际IP。

Note that once I get to the soundcloud page I am manually logging in, but I still get a message that says 'Our robots think you are a robot. 请注意,一旦我进入soundcloud页面,便会手动登录,但仍然收到一条消息,内容为“我们的机器人认为您是机器人。 Try reloading the page...' 尝试重新加载页面...”

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options


proxy = '0.0.0.0:0'
seleniumproxy = '--proxy-server={}'.format(proxy)
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument(seleniumproxy)
chrome_options.add_argument('disable-infobars')
chrome_options.add_argument('--disable-extensions')
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('https://soundcloud.com/')

Just hoping to be able to get my script to login. 只是希望能够让我的脚本登录。 I was not able to find the usage of a distil network in the dom. 我在dom中找不到分布式网络的用法。 That said I am not super proficient in reading JS or anything so I could have easily missed it. 那就是说我不太精通阅读JS或其他任何东西,所以我很容易错过它。

You want to avoid detection right? 您要避免检测对吗?

Try to add below code into your script. 尝试将以下代码添加到脚本中。

I have tested your code and sign in successfully. 我已经测试了您的代码并成功登录。

# set developer mode 
chrome_options.add_experimental_option('excludeSwitches', ['enable-automation'])

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM