from selenium import webdriver from time import sleep import sys sys.path.append(r'C:\Users\LENOVO\Desktop\python\美腾\zhixin\login_zx') from login__zhixin import LoginZhiXin sys.path.append(r'C:\Users\LENOVO\Desktop\python\美腾\zhiyou\登录') from login__zhiyou import LoginZhiYou driver = webdriver.Chrome() # driver.maximize_window() LoginZhiXin(driver).login_zhixin("13820921009", "1111qqqq") LoginZhiYou(driver).login_zhiyou() driver.find_element_by_xpath('//*[@id="menu"]/li[2]').click() sleep(1) for num in range(1, 10): name5 = driver.find_element_by_xpath("//*[@id='temp']/div/div[" + str(num) + "]/div/div/div[2]/div[1]/p[1]").text # 选择项目主题 qq = '测试临时项目1.1' if qq in name5: driver.find_element_by_xpath("//*[@id='temp']/div/div[" + str(num) + "]/div/div/div[2]/div[1]/p[1]").click() sleep(1) driver.find_element_by_xpath('//*[@id="addNew"]/div/div/div[1]/img').click() sleep(1) # 输入邮件主题、重要收件人、邮件内容、发送邮件 driver.find_element_by_xpath( '//*[@id="mail-chat"]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[2]/div[2]/input' ).send_keys("11112222") driver.find_element_by_xpath(
from login__zhixin import LoginZhiXin sys.path.append(r'C:\Users\LENOVO\Desktop\python\美腾\zhiyou\登录') from login__zhiyou import LoginZhiYou sys.path.append(r'C:\Users\LENOVO\Desktop\python\美腾\tongyong') from common1 import Base class LoginZhiYouGuanLi(): def __init__(self, driver): self.driver = driver def login_zhiyou_guanli(self): sleep(1) # 进入项目管理端 loc1 = (By.XPATH, ".//div[@class = 'user-name']/button") Base.click(self, loc1, self.driver) sleep(1) c = self.driver.window_handles self.driver.switch_to_window(c[-1]) if __name__ == "__main__": driver = webdriver.Chrome() zhixin = LoginZhiXin(driver) zhiyou = LoginZhiYou(driver) zhiyou_guanli = LoginZhiYouGuanLi(driver) zhixin.login_zhixin("13820921009", "1111qqqq") sleep(1) zhiyou.login_zhiyou() sleep(1) zhiyou_guanli.login_zhiyou_guanli()