在用selenium登录淘宝的时候跳出验证码滑块,滑动但是一直失败(搜了说是被检测了),但是修改了navigator.webdriver还是失败。
from selenium.webdriver import Chrome
import time
# window.navigator.webdriver 控制台输入这个
brower = Chrome(executable_path=r'C:\Program Files\Google\Chrome\Application\chromedriver.exe')
url1 = 'https://s.taobao.com/search?q=%E8%A3%A4%E5%AD%90'
time.sleep(2)
brower.get(url1)
script = 'Object.defineProperty(navigator,"webdriver",{get:() => undefined,});'
# 运行Javascript
brower.execute_script(script)
# 定位按钮并点击
# time.sleep(2)
# brower.find_element_by_xpath('//*[@id="fm-login-id"]').send_keys('17123123123')
# 到这一步就会跳出滑块验证码
# time.sleep(3)
# brower.find_element_by_xpath('//*[@id="fm-login-password"]').send_keys('1231213')
# time.sleep(3)