自动评价

#导入模块
import time
from selenium import webdriver

#打开浏览器
from selenium.webdriver.common.by import By

driver=webdriver.Chrome()
driver.maximize_window()

#打开网页
driver.get('http://stu.1000phone.net/student.php/Public/login')
print(driver.title)
print(driver.current_url)

#元素定位和操作方式
driver.find_element_by_name('Account').send_keys('')
time.sleep(2)
driver.find_element_by_name('PassWord').send_keys('')
time.sleep(2)
driver.find_element_by_tag_name('button').click()
time.sleep(2)
driver.find_element_by_link_text('学员评价').click()
driver.find_element_by_link_text('开始评价').click()
lables=driver.find_elements_by_xpath('//*[@id="topic"]//tr//td/label[1]')
for lable in lables:
    lable.click()
# textarea=driver.find_elements_by_tag_name('textarea')
# for t in textarea:
#     t.send_keys('6666')
driver.find_element_by_id('NakdEA').send_keys('666')
time.sleep(1)
driver.find_element_by_id('addstudent').click()


你可能感兴趣的:(爬虫)