• Page--PageBoard



    from selenium import webdriver
    import time,os
    from cwp.Page.PageLogin import PageLogin
    from selenium.webdriver.common.action_chains import ActionChains
    from selenium.webdriver.common.by import By


    class PageBoard():
    def __init__(self, driver=None):
    if driver is None:
    os.system('taskkill /im chromedriver.exe /F')
    self.driver = webdriver.Chrome()
    else:
    self.driver = driver

    #定义元素
    uesrleader_loc = (By.XPATH,'id("menu-cwp-pps")/li[2]/a[1]/span[1]/span[1]')
    weixinuser_loc = (By.XPATH,'id("menu-userManagement")/li[1]/a[1]/span[1]/span[1]')
    newadd_loc = (By.XPATH,'id("datagrid-toolbar")/a[1]/span[1]')
    name_loc = (By.ID,'saveForm-name')
    phonenum_loc = (By.ID,'saveForm-phoneNo')
    huozhukuang_loc = (By.XPATH,'//*[@id="saveForm"]/div[4]/span[2]/span')
    chosehuozhu_loc = (By.ID,'datagrid-row-r2-2-1')
    savebtn_loc = (By.XPATH,'id("saveForm-button")/a[1]/span[1]')


    def publish(self):
    pagelogin = PageLogin(self.driver)
    page_board = pagelogin.login('admin', '123', '1024')

    self.driver.find_element(*self.uesrleader_loc).click()
    time.sleep(1)
    self.driver.find_element(*self.weixinuser_loc).click()
    time.sleep(1)
    self.driver.switch_to_frame('frame_outsideUserManage')
    self.driver.find_element(*self.newadd_loc).click()

    time.sleep(1)
    self.driver.find_element(*self.name_loc).send_keys("测试")
    time.sleep(1)
    self.driver.find_element(*self.phonenum_loc).send_keys("13888888886")
    time.sleep(1)
    self.driver.find_element(*self.huozhukuang_loc).click()

    self.driver.find_element(*self.chosehuozhu_loc).click()

    self.driver.find_element(*self.huozhukuang_loc).click()

    time.sleep(1)
    self.driver.find_element(*self.savebtn_loc).click()
    """
    self.driver.find_element_by_xpath('id("menu-cwp-pps")/li[2]/a[1]/span[1]/span[1]').click()
    time.sleep(1)
    self.driver.find_element_by_xpath('id("menu-userManagement")/li[1]/a[1]/span[1]/span[1]').click()
    time.sleep(1)

    self.driver.switch_to_frame('frame_outsideUserManage')
    self.driver.find_element_by_xpath('id("datagrid-toolbar")/a[1]/span[1]').click()

    time.sleep(1)
    self.driver.find_element_by_id('saveForm-name').send_keys("测试")
    time.sleep(1)
    self.driver.find_element_by_id('saveForm-phoneNo').send_keys("13888888886")
    time.sleep(1)
    self.driver.find_element_by_xpath('//*[@id="saveForm"]/div[4]/span[2]/span').click()

    self.driver.find_element_by_id('datagrid-row-r2-2-1').click()

    self.driver.find_element_by_xpath('//*[@id="saveForm"]/div[4]/span[2]/span/a').click()

    time.sleep(1)
    self.driver.find_element_by_xpath('id("saveForm-button")/a[1]/span[1]').click()
    """


    if __name__=="__main__":
    pageboard1 = PageBoard()
    pageboard1.publish()

  • 相关阅读:
    SDOI 2016 数字配对
    SDOI 2016 征途 决策单调性
    SDOI 2016 生成魔咒
    SDOI 2016 排列计数
    【SC主题公园杯】三个袋子 = =不动脑的后果
    【BZOJ3050】【USACO 2013 Jan Gold金组】坐座位 Seating
    MillerRabin 快速的素数概率判定法
    [POJ3189][cqbzoj1640]稳定的奶牛分配 解题报告
    最大流 isap 模板
    【POJ 1324】Holedox Moving A*宽搜
  • 原文地址:https://www.cnblogs.com/wenjing2019/p/12102357.html
Copyright © 2020-2023  润新知