利用python3+Selenium 实现自动看课(demo)

from selenium import webdriver# from selenium.webdriver.chrome.options import Optionsfrom time import sleepfrom selenium.webdriver import ActionChains# 设置无头浏览器# chrome_options = Options()# chrome_options.add_argument('--headless')# chrome_options.
摘要由CSDN通过智能技术生成


​from selenium import webdriver
# from selenium.webdriver.chrome.options import Options
from time import sleep
from selenium.webdriver import ActionChains
# from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait




# chrome_options = Options()
# chrome_options.add_argument('--headless')
# chrome_options.add_argument('--disable-gpu')
# chrome_options.add_argument('-kiosk')


class Auto_Brush():
    bro = webdriver.Chrome(executable_path="chromedriver.exe")
    bro.maximize_window()
    bro.implicitly_wait(10)
    title = None
    js = "document.getElementsByClassName('controlsBar')[0].style.display='block'"

    def login(self, password, username):
    # url = "https://www.zhihuishu.com/"
        self.bro.get(url)
        try:
            self.bro.find_element_by_xpath('//*[@id="notLogin"]/span/a[1]').click()
            # username
            self.bro.find_element_by_xpath('//*[@id="lUsername"]').send_keys(username)
            # password
            self.bro.find_element_by_xpath('//*[@id="lPassword"]').send_keys(password)
            # con
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值