第一题脚本
from selenium import webdriver
inport time
from selenium.webriver.support. select import Select
driverebdriver.Chrome()
driver.get('http://192.168.47.5:42095/sathr/logon )
driver.find_element_by_xpath("//*[@id'usernae']").send_keys("hrteacher")
driver.find_element_by_nane("passrord").send_keys("123456")
driver.find_element_by_id("loginBtn").click()
time.sleep(3)
driver.find_lement_by_partial_lirk_text("人资工资台").click()
tine.sleep(5)
driver.find_element_by_link_text("员工基本信息管理").click()
driver.find_element_by_link_text("员工照片管理").click()
sel1=driver.find_element_by_name("existFlag").click()
time.sleep(2)
Select(sel1).select_by_visible_text("未上传")
driver.find_element_by_id("searchForm").click()
time.sleep(2)
driver.find_element_by_xpath("//*[@id='pageContent']/div[2]/div/div/div/div[2]/table/tbody/tr/td[9]/a").click()
time.sleep(2)
driver.find_element_by_xpath("//*[@id='rt_rt_1girfbj6v176og7c14741mf6l3k1']/label")//需修改路径
driver.get_screenshot_as_file(r"c:\User\ks\Desktop")//需修改路径
driver.quit()
第二题脚本
from selenium import webdriver
inport time
from selenium.webriver.support. select import Select
driverebdriver.Chrome()
driver.get('http://192.168.47.5:42095/sathr/logon )
driver.find_element_by_xpath("//*[@id'usernae']").send_keys("hrteacher")
driver.find_element_by_nane("passrord").send_keys("123456")
driver.find_element_by_id("loginBtn").click()
time.sleep(3)
driver.find_element_by_text("门户首页按钮").click()