前言
在经过不懈努力之后,终于过了知乎的滑动。虽然不是从算法层面的。略显拉跨
提示:以下是本篇文章正文内容
一、代码块
在开始运行代码之前,可以去搜索一下selenium接管浏览器,文中需要用到
代码如下:
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time, requests
import cv2
import numpy as np
import re
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
zh = webdriver.Chrome(r'E:\pycharm\pythonProject\Reptile\自动化测试\chromedriver.exe', chrome_options=chrome_options)
zh.get('https://www.zhihu.com/signin?next=%2F')
#登录
def login():
element = zh.find_element_by_css_selector('[class="SignFlow-tab"]').click()
zh.implicitly_wait(3)
username = zh.find_element_by_css_selector('[placeholder="手机号或邮箱"]')
zh.im