题在这里
http://cytao.top/PDF/1+x题库第一题.pdf
from selenium import webdriver
from selenium.webdriver import ActionChains
#1+x自动化测试第一排第一个的第一题
driver=webdriver.Chrome()
driver.maximize_window()
driver.get("http://192.168.0.108:8080/suthr/logon")
driver.find_element_by_name("username").send_keys("hrteacher")
driver.find_element_by_id("password").send_keys("123456")
acction=driver.find_element_by_id("loginBtn")
ActionChains(driver).click(acction).perform()
driver.find_element_by_link_text("门户首页").click()
driver.find_element_by_xpath("/html/body/div[3]/div[1]/div/div/div/div[2]/div[2]/div/a/img").click()
driver.get_screenshot_as_file(r"C:/Users/Litao/Desktop/1.png")
driver.switch_to_window(driver.window_handles[1])
driver.find_element_by_partial_link_text("帖子中心").click()
driver.get_screenshot_as_file(r"C:/Users/Litao/Desktop/2.png")
driver.close()
#1+x自动化测试第一排第一个的第二题
from selenium.webdriver.support.select import Select
driver=webdriver.Chrome()
driver.maximize_window()
driver.get("http://192.168.0.108:8080/suthr/logon")
driver.find_element_by_name("username").send_keys("hrteacher")
driver.find_element_by_id("password").send_keys("123456")
driver.find_element_by_xpath("//*[@id='loginBtn']").click()
driver.find_element_by_partial_link_text("工作台").click()
driver.find_element_by_class_name("icon-user").click()
driver.find_element_by_link_text("员工照片管理").click()
Select(driver.find_element_by_name("teacherStatusId")).select_by_value("1")
driver.find_element_by_css_selector("#searchForm > div > button").click()
driver.find_element_by_xpath("//*[@id='pageContent']/div[2]/div/div/div/div[2]/table/tbody/tr/td[9]/a").click()
driver.find_element_by_name("file").send_keys(r"C:\Users\Litao\Desktop\11.png")
driver.get_screenshot_as_file(r"C:\Users\Litao\Desktop\3.png")
评论 (0)