我试图在twitter上注册使用硒和使用2captcha API来解决验证码,但由于某种原因,当点击继续页面刷新,不继续
captchaInput = twitter_driver.find_element_by_id('g-recaptcha-response')
print("Text area set to visible")
twitter_driver.execute_script("arguments[0].setAttribute('style','display:visible;');", captchaInput)
time.sleep(5)
print("Entering captcha token")
captchaInput.send_keys(captcha_token)
time.sleep(5)
button_click = "javascript:document.getElementById('continue_button').click();"
twitter_driver.execute_script(button_click)
如果你在Python上写,试着这样做
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#your selector'))).click()
there very good all written https://selenium-python.readthedocs.io/locating-elements.html#:~:text=content%20%3D%20driver.find_element_by_css_selector(%27p.content%27)
如果是你的,不要尝试更详细地描述错误
回答我自己的问题只是为了记录,twitter使用回调验证码所以未解决的验证码会重新加载页面即使你通过JS点击提交按钮
这个要点帮助我解决了验证码问题