鱼C论坛

 找回密码
 立即注册
查看: 1471|回复: 3

[已解决]关于爬虫代码优化的 问题

[复制链接]
发表于 2021-6-13 18:56:58 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
from selenium import webdriver
import time

driver = webdriver.Chrome()
driver.get('**************')#打开教务系统 保护隐私此处不显示

time.sleep(2)#延时2s 防止网络缓慢

#输入账号密码
driver.find_element_by_xpath('//*[@id="input_username"]').send_keys('*******')#此处需要修改自己的账号
driver.find_element_by_xpath('//*[@id="input_password"]').send_keys('***********')#此处需要修改自己的密码

time.sleep(8)#延时8s 手动输入验证码

driver.find_element_by_xpath('//*[@id="loginButton"]').click()#点击登录

time.sleep(2)#延时2s 用于登录时间

#打开教学评估
driver.find_element_by_xpath('//*[@id="12580300"]/a/span').click()
time.sleep(1)#延时1s 用于加载网页等待时间
driver.find_element_by_xpath('//*[@id="12580302"]/a').click()
time.sleep(1)#延时1s 用于加载网页等待时间

#点各个老师评价
driver.find_element_by_xpath('//*[@id="jxpgtbody"]/tr[1]/td[1]/button').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[43]/td/div/textarea').send_keys('这老师不赖')#此处需要修改自己对老师的评价
time.sleep(123)#用于等待系统时间
driver.find_element_by_xpath('//*[@id="buttonSubmit"]').click()
time.sleep(37)#用于等待系统响应时间

driver.find_element_by_xpath('//*[@id="jxpgtbody"]/tr[2]/td[1]/button').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[43]/td/div/textarea').send_keys('这老师不赖')#此处需要修改自己对老师的评价
time.sleep(123)#用于等待系统时间
driver.find_element_by_xpath('//*[@id="buttonSubmit"]').click()
time.sleep(5)#用于等待系统响应时间

driver.find_element_by_xpath('//*[@id="jxpgtbody"]/tr[3]/td[1]/button').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[43]/td/div/textarea').send_keys('这老师不赖')#此处需要修改自己对老师的评价
time.sleep(123)#用于等待系统时间
driver.find_element_by_xpath('//*[@id="buttonSubmit"]').click()
time.sleep(5)#用于等待系统响应时间

driver.find_element_by_xpath('//*[@id="jxpgtbody"]/tr[4]/td[1]/button').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[43]/td/div/textarea').send_keys('这老师不赖')#此处需要修改自己对老师的评价
time.sleep(123)#用于等待系统时间
driver.find_element_by_xpath('//*[@id="buttonSubmit"]').click()
time.sleep(5)#用于等待系统响应时间

driver.find_element_by_xpath('//*[@id="jxpgtbody"]/tr[5]/td[1]/button').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[43]/td/div/textarea').send_keys('这老师不赖')#此处需要修改自己对老师的评价
time.sleep(123)#用于等待系统时间
driver.find_element_by_xpath('//*[@id="buttonSubmit"]').click()
time.sleep(5)#用于等待系统响应时间

driver.find_element_by_xpath('//*[@id="jxpgtbody"]/tr[6]/td[1]/button').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[43]/td/div/textarea').send_keys('这老师不赖')#此处需要修改自己对老师的评价
time.sleep(123)#用于等待系统时间
driver.find_element_by_xpath('//*[@id="buttonSubmit"]').click()
time.sleep(5)#用于等待系统响应时间

driver.find_element_by_xpath('//*[@id="jxpgtbody"]/tr[7]/td[1]/button').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[43]/td/div/textarea').send_keys('这老师不赖')#此处需要修改自己对老师的评价
time.sleep(123)#用于等待系统时间
driver.find_element_by_xpath('//*[@id="buttonSubmit"]').click()
time.sleep(5)#用于等待系统响应时间

driver.find_element_by_xpath('//*[@id="jxpgtbody"]/tr[8]/td[1]/button').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[43]/td/div/textarea').send_keys('这老师不赖')#此处需要修改自己对老师的评价
time.sleep(123)#用于等待系统时间
driver.find_element_by_xpath('//*[@id="buttonSubmit"]').click()
time.sleep(5)#用于等待系统响应时间

driver.find_element_by_xpath('//*[@id="jxpgtbody"]/tr[9]/td[1]/button').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[43]/td/div/textarea').send_keys('这老师不赖')#此处需要修改自己对老师的评价
time.sleep(123)#用于等待系统时间
driver.find_element_by_xpath('//*[@id="buttonSubmit"]').click()
time.sleep(5)#用于等待系统响应时间


driver.find_element_by_xpath('//*[@id="jxpgtbody"]/tr[10]/td[1]/button').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[43]/td/div/textarea').send_keys('这老师不赖')#此处需要修改自己对老师的评价
time.sleep(123)#用于等待系统时间
driver.find_element_by_xpath('//*[@id="buttonSubmit"]').click()

由于太懒不想一个一个点评价所以就现学一下爬虫  但是又不太懂python  我想把后面的  #点各个老师评价  部分可不可以写成一个for循环呢 求大佬能不能改一下或者解答一下
最佳答案
2021-6-14 08:06:58
像这样有规律的  都可以循环一下:
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()

for x in range(3,42,2):
   driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[%d]/td/div[1]/label/span[1]'%x).click()
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-6-14 07:14:15 From FishC Mobile | 显示全部楼层
太可以了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-6-14 08:06:58 | 显示全部楼层    本楼为最佳答案   
像这样有规律的  都可以循环一下:
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[3]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[5]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[7]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[9]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[11]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[13]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[15]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[17]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[19]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[21]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[23]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[25]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[27]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[29]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[31]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[33]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[35]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[37]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[39]/td/div[1]/label/span[1]').click()
driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[41]/td/div[1]/label/span[1]').click()

for x in range(3,42,2):
   driver.find_element_by_xpath('//*[@id="page-content-template"]/div/div/div[1]/form/div/table/tbody/tr[%d]/td/div[1]/label/span[1]'%x).click()
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-6-14 14:13:23 | 显示全部楼层
wp231957 发表于 2021-6-14 08:06
像这样有规律的  都可以循环一下:

哦,太感谢你了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-1-15 13:09

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表