zoukankan      html  css  js  c++  java
  • 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()

  • 相关阅读:
    你是老鸟吗?但是有些你可能目前都不知道的东西
    工具类合集
    也谈Flash mmorpg地图问题【转】
    大量实用工具类、开源包,该帖绝对值得你收藏!
    如何设计产品【页游】
    网络游戏中,玩家常常询问什么时候开新服,其中的本质需求是什么?
    大将军UE分析
    天天连萌UE分析
    selenium IDE 回放报错
    jenkins配置
  • 原文地址:https://www.cnblogs.com/wenjing2019/p/12102357.html
Copyright © 2011-2022 走看看