我目前正在使用Python和Selify自动化我的Twitter帐户的登录过程.
然而,我面临着一个问题,Twitter的反机器人措施似乎检测到了自动化,当点击next button时,检测到了immediately redirect me to the homepage.
我曾try 使用send_keys
和ActionChains来创建更多类似人类的交互,但问题仍然存在.
下面是一个简化的代码片段,它说明了我当前的方法:
# imports...
driver.get(URLS.login)
username_input = driver.find_element(By.NAME, 'text')
username_input.send_keys(username)
next_button = driver.find_element(By.XPATH, '//div[@role="button"]')
# These attempts all failed and return to the homepage
next_button.click()
next_button.send_keys(Keys.ENTER)
ActionChains(driver).move_to_element(next_button).click().perform()
奇怪的是,除了手动点击下一步按钮外,execute a 100 in console还可以使用.
我怀疑我的自动化try 仍在被Twitter的安全机制检测到,但我不确定根本原因或如何成功绕过它.