Advertisement

使用Selenium模拟登录知乎账户并解决随机出现的验证码问题

阅读量:
复制代码
    import requests
    from selenium import webdriver
    from bs4 import BeautifulSoup
    import time
    
复制代码
    while True:
    #option = webdriver.ChromeOptions()
    #option.set_headless()
    #因为要手动输入验证码,所以无头模式注释掉
    driver = webdriver.Chrome(r'C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe')
    driver.get('http://www.zhihu.com')
    driver.find_element_by_xpath('//*[@id="root"]/div/main/div/div/div/div[2]/div[2]/span').click()
    driver.find_element_by_xpath('//*[@id="root"]/div/main/div/div/div/div[2]/div[1]/form/div[1]/div[2]/div[1]/input').send_keys(

全部评论 (0)

还没有任何评论哟~