コード例 #1
0
 def delete(self):
     Log().info("删除首页第4个数据")
     # WebDriverWait(self.d, 10, 1).until(lambda ele: self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[2]/td[7]/div/button[3]/span'))
     # self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[1]/td[7]/div/button[3]/span').click()
     WebDriverWait(
         self.d, 10, 1
     ).until(lambda ele: self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[4]/td[7]/div/button[3]'
     ))
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[4]/td[7]/div/button[3]'
     ).click()
     try:
         Log().info("点击确认")
         self.d.find_element_by_xpath(
             '/html/body/div[6]/div/div[3]/button[2]').click()
         WebDriverWait(
             self.d, 60,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 'body > div.el-message.el-message--success'))
         m = self.d.find_element_by_css_selector(
             "body > div.el-message.el-message--success").text
         Log().info("删除成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("异常原因:切片模版正在被使用无法删除")
         screenshot(self.d, 'qiepian')
         raiseout()
コード例 #2
0
    def select(self, name):
        Log().info("输入业务名称")
        self.d.find_element_by_xpath(
            '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[1]/div/div/input'
        ).send_keys(name)

        self.d.find_element_by_xpath(
            '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[3]/div/button[2]'
        ).click()
        try:
            Log().info("点击提交")
            WebDriverWait(
                self.d, 10, 1
            ).until(lambda ele: self.d.find_element_by_xpath(
                '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr/td[1]/div'
            ))
            m = self.d.find_element_by_xpath(
                '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr/td[1]/div'
            ).text
            Log().info("查找成功")
            self.d.close()
            return m
        except Exception:
            Log().debug("异常原因:未找到该元素")
            screenshot(self.d, 'yewu')
            raiseout()
コード例 #3
0
 def select_cj(self, name):
     Log().info("输入场景名称进行查找")
     WebDriverWait(
         self.d, 10, 1
     ).until(lambda ele: self.d.find_element_by_css_selector(
         "#index > div.second-container > div.main-wrapper > div > div:nth-child(2) > div.common-search > form > div:nth-child(1) > div > div > input"
     ))
     self.d.find_element_by_css_selector(
         "#index > div.second-container > div.main-wrapper > div > div:nth-child(2) > div.common-search > form > div:nth-child(1) > div > div > input"
     ).send_keys(name)
     sleep(1)
     try:
         self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[3]/div/button[2]'
         ).click()
         sleep(1)
         m = self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[1]/td[5]/div/button[1]'
         ).text
         Log().info("查找成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("异常原因:未找到该元素")
         screenshot(self.d, 'changjing')
         raiseout()
コード例 #4
0
 def pldaoru(self, wenjian):
     Log().info("点击批量导入")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[1]/div/span'
     ).click()
     sleep(1)
     Log().info("选择文件")
     self.d.find_element_by_name("file").send_keys(wenjian)
     sleep(1)
     try:
         self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div/div[3]/div/button[1]'
         ).click()
         sleep(2)
         WebDriverWait(
             self.d, 10,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 "body > div.el-message.el-message--success"))
         m = self.d.find_element_by_css_selector(
             'body > div.el-message.el-message--success').text
         Log().info(m)
         self.d.close()
         return m
     except Exception:
         Log().debug("异常原因:终端用户手机号不能重复")
         screenshot(self.d, 'zhongduan')
         raiseout()
コード例 #5
0
 def delete(self):
     #第二页
     # WebDriverWait(self.d, 60, 1).until(lambda ele: self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[2]/ul/li[2]'))
     # self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[2]/ul/li[2]').click()
     # sleep(2)
     Log().info("点击删除第3条数据]")
     WebDriverWait(
         self.d, 60, 1
     ).until(lambda ele: self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[3]/td[5]/div/button[2]'
     ))
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[3]/td[5]/div/button[2]'
     ).click()
     sleep(1)
     Log().info("确认删除")
     try:
         self.d.find_element_by_xpath(
             '/html/body/div[2]/div/div[3]/button[2]').click()
         WebDriverWait(
             self.d, 60,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 'body > div.el-message.el-message--success'))
         m = self.d.find_element_by_css_selector(
             "body > div.el-message.el-message--success").text
         Log().info("删除成功")
         self.d.close()
         return m
     except Exception:
         self.d.find_element_by_xpath(
             '/html/body/div[2]/div/div[3]/button/span').click()
         Log().debug("异常原因:场景正在被使用无法删除")
         screenshot(self.d, 'yewu')
         raiseout()
         self.d.close()
コード例 #6
0
 def state(self):
     Log().info("专网租户详情页跳转")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[1]/td[2]/div/a'
     ).click()
     sleep(1)
     try:
         WebDriverWait(
             self.d, 10,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 'button.is-plain:nth-child(1)'))
         self.d.find_element_by_css_selector(
             'button.is-plain:nth-child(1)').click()
         sleep(1)
         self.d.find_element_by_xpath(
             '/html/body/div[2]/div/div[3]/button[2]').click()
         WebDriverWait(self.d, 30,
                       0.5).until(lambda ele: self.d.find_element_by_xpath(
                           '/html/body/div[3]/p'))
         m = self.d.find_element_by_xpath('/html/body/div[3]/p').text
         Log().info("专网配置成功")
         return m
     except Exception:
         Log().debug("专网配置失败")
         screenshot(self.d, 'zhongduan')
         raiseout()
コード例 #7
0
 def betch_delete(self):
     Log().info("选择批量删除元素")
     WebDriverWait(
         self.d, 10, 1
     ).until(lambda ele: self.d.find_element_by_xpath(
         '/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[1]/td[1]/div/label/span/span'
     ))
     self.d.find_element_by_xpath(
         '/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[1]/td[1]/div/label/span/span'
     ).click()
     sleep(1)
     self.d.find_element_by_xpath(
         '/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[2]/td[1]/div/label/span/span'
     ).click()
     sleep(1)
     self.d.find_element_by_xpath(
         '/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/div/span[1]'
     ).click()
     sleep(1)
     Log().info("点击确认删除")
     try:
         self.d.find_element_by_xpath(
             '/html/body/div[2]/div/div[3]/button[2]').click()
         WebDriverWait(self.d, 30, 1).until(
             lambda ele: self.d.find_element_by_css_selector('.el-message'))
         m = self.d.find_element_by_css_selector('.el-message').text
         Log().info("批量删除成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("删除失败")
         screenshot(self.d, 'zhongduan')
         raiseout()
コード例 #8
0
 def add(self,url):
     Log().info("点击添加mec")
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[1]/span').click()
     sleep(1)
     try:
         Log().info("选择租户")
         self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[3]/div/div[2]/form/div[1]/div/div/div/span/span/i').click()
         sleep(2)
         WebDriverWait(self.d,30,0.5).until(lambda ele:self.d.find_element_by_xpath('/html/body/div[5]/div[1]/div[1]/ul/li[3]'))
         self.d.find_element_by_xpath('/html/body/div[5]/div[1]/div[1]/ul/li[3]').click()
         sleep(1)
         Log().info("选择厂商")
         self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[3]/div/div[2]/form/div[2]/div/div/div[1]/span/span/i').click()
         sleep(1)
         self.d.find_element_by_xpath('/html/body/div[5]/div[1]/div[1]/ul/li[4]').click()
         sleep(1)
         Log().info("输入url")
         self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[3]/div/div[2]/form/div[3]/div/div[1]/input').send_keys(url)
         sleep(1)
         Log().info("点击确认")
         self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[3]/div/div[3]/div/button[1]').click()
         WebDriverWait(self.d, 10, 1).until(lambda ele: self.d.find_element_by_css_selector('body > div.el-message.el-message--success'))
         t = self.d.find_element_by_css_selector('body > div.el-message.el-message--success').text
         Log().info("添加成功")
         self.d.close()
         return t
     except Exception :
         Log().debug("异常原因:该租户已添加mec且租户只能添加一个")
         screenshot(self.d, 'mec')
         raiseout()
コード例 #9
0
 def delete(self):
     Log().info("删除第3条数据")
     # WebDriverWait(self.d, 60, 1).until(lambda ele: self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[2]/ul/li[2]'))
     # self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[2]/ul/li[2]').click()
     # sleep(2)
     WebDriverWait(
         self.d, 60, 1
     ).until(lambda ele: self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[3]/td[6]/div/button[3]'
     ))
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[3]/td[6]/div/button[3]'
     ).click()
     sleep(1)
     try:
         Log().info("点击删除")
         self.d.find_element_by_css_selector(
             'body > div.el-message-box__wrapper > div > div.el-message-box__btns > button.el-button.el-button--default.el-button--small.el-button--primary > span'
         ).click()
         WebDriverWait(
             self.d, 60,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 'body > div.el-message.el-message--success'))
         m = self.d.find_element_by_css_selector(
             "body > div.el-message.el-message--success").text
         Log().info("删除成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("异常原因:专网等级模版正在被使用无法删除")
         screenshot(self.d, 'zhuanwang')
         raiseout()
コード例 #10
0
 def delete(self):
     Log().info("选择第二页数据删除")
     WebDriverWait(
         self.d, 10, 1
     ).until(lambda ele: self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[3]/td[5]/div/button[2]'
     ))
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[3]/td[5]/div/button[2]'
     ).click()
     try:
         Log().info("点击删除")
         self.d.find_element_by_xpath(
             '/html/body/div[2]/div/div[3]/button[2]').click()
         WebDriverWait(
             self.d, 60,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 'body > div.el-message.el-message--success'))
         m = self.d.find_element_by_css_selector(
             "body > div.el-message.el-message--success").text
         Log().info("删除成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("删除失败")
         screenshot(self.d, 'yewu')
         raiseout()
コード例 #11
0
ファイル: scene.py プロジェクト: manito-666/Unittest_UItest
 def add(self,name,beizhu):
     Log().info("添加场景")
     WebDriverWait(self.d,10,1).until(lambda ele:self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/span'))
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/span').click()
     Log().info("输入场景名字")
     self.d.find_element_by_xpath( '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[2]/form/div[1]/div/div/input').send_keys(name)
     sleep(1)
     Log().info("选择行业")
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[2]/form/div[2]/div/div/div[1]/span/span/i').click()
     sleep(1)
     self.d.find_element_by_xpath('/html/body/div[3]/div[1]/div[1]/ul/li[2]').click()
     sleep(1)
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[2]/form/div[3]/div/div/textarea').send_keys(beizhu)
     Log().info("点击提交")
     try:
         self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[3]/div/button[1]').click()
         WebDriverWait(self.d, 10, 1).until(lambda ele: self.d.find_element_by_css_selector('body > div.el-message.el-message--success > p'))
         t = self.d.find_element_by_css_selector('body > div.el-message.el-message--success > p').text
         Log().info("添加成功")
         self.d.close()
         return t
     except Exception :
         Log().debug("异常原因:场景名不能重复")
         screenshot(self.d,'changjing')
         raiseout()
コード例 #12
0
ファイル: scene.py プロジェクト: manito-666/Unittest_UItest
 def alter(self,name):
     Log().info("点击编辑")
     WebDriverWait(self.d,10,1).until(lambda ele:self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[2]/td[5]/div/button[1]'))
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[2]/td[5]/div/button[1]').click()
     sleep(2)
     Log().info("修改场景名称")
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[2]/form/div[1]/div/div/input').clear()
     sleep(1)
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[2]/form/div[1]/div/div/input').send_keys(name)
     sleep(1)
     Log().info("修改备注")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[2]/form/div[3]/div/div/textarea').clear()
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[2]/form/div[3]/div/div/textarea').send_keys("自动化测试")
     sleep(1)
     try:
         Log().info("点击提交")
         self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[3]/div/button[1]').click()
         WebDriverWait(self.d, 10, 1).until(lambda ele: self.d.find_element_by_css_selector('body > div.el-message.el-message--success'))
         t = self.d.find_element_by_css_selector('body > div.el-message.el-message--success').text
         Log().info("修改成功")
         self.d.close()
         return t
     except Exception :
         Log().debug("修改失败")
         screenshot(self.d, 'changjing')
         raiseout()
コード例 #13
0
 def delete(self):
     Log().info("删除第二页第一个元素")
     WebDriverWait(
         self.d, 30, 1
     ).until(lambda ele: self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[1]/td[9]/div/button[2]'
     ))
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[1]/td[9]/div/button[2]'
     ).click()
     WebDriverWait(self.d, 30,
                   1).until(lambda ele: self.d.find_element_by_xpath(
                       '/html/body/div[2]/div/div[3]/button[2]/span'))
     Log().info("确认删除")
     self.d.find_element_by_xpath(
         '/html/body/div[2]/div/div[3]/button[2]/span').click()
     try:
         WebDriverWait(
             self.d, 60,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 'body > div.el-message.el-message--success'))
         m = self.d.find_element_by_css_selector(
             "body > div.el-message.el-message--success").text
         Log().info("删除成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("异常原因:无法删除")
         screenshot(self.d, 'zhongduan')
         raiseout()
コード例 #14
0
    def select2(self):
        Log().info("根据行业等级场景查询")
        self.d.find_element_by_xpath(
            '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[2]/div/div/div/span/span/i'
        ).click()
        sleep(1)
        Log().info("选择行业")
        self.d.find_element_by_css_selector(
            'body > div.el-select-dropdown.el-popper > div.el-scrollbar > div.el-select-dropdown__wrap.el-scrollbar__wrap > ul > li:nth-child(2)'
        ).click()
        sleep(1)
        Log().info("选择等级")
        self.d.find_element_by_xpath(
            '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[3]/div/div/div[1]/span/span/i'
        ).click()
        sleep(1)
        self.d.find_element_by_xpath(
            '/html/body/div[3]/div[1]/div[1]/ul/li[1]').click()

        try:
            self.d.find_element_by_xpath(
                '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[6]/div/button[2]'
            ).click()
            sleep(1)
            m = self.d.find_element_by_xpath(
                '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[1]/td[7]/div/button[2]'
            ).text
            Log().info("查询成功")
            self.d.close()
            return m
        except Exception:
            Log().debug("异常原因:未找到该元素")
            screenshot(self.d, 'qiepian')
            raiseout()
コード例 #15
0
 def peizhi_1(self):
     Log().info("点击租户名称")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[1]/td[2]/div/a'
     ).click()
     sleep(1)
     Log().info("点击专网配置")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/button[1]'
     ).click()
     sleep(1)
     Log().info("点击引用专网等级模版")
     WebDriverWait(
         self.d, 30, 1
     ).until(lambda ele: self.d.find_element_by_css_selector(
         '#index > div.second-container > div.main-wrapper > div > div.tenant-container > div.detail-content > div.content > div.topo > div.network-setting-dialog > div:nth-child(1) > div > div.el-dialog__body > form > div:nth-child(1) > div > button > span'
     ))
     self.d.find_element_by_css_selector(
         '#index > div.second-container > div.main-wrapper > div > div.tenant-container > div.detail-content > div.content > div.topo > div.network-setting-dialog > div:nth-child(1) > div > div.el-dialog__body > form > div:nth-child(1) > div > button > span'
     ).click()
     sleep(1)
     Log().info("选择模版")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/div[5]/div[2]/div/div[2]/div/div/div[1]/div[2]/div[3]/table/tbody/tr/td[2]/div/label'
     ).click()
     sleep(1)
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/div[5]/div[2]/div/div[2]/div/div/div[3]/div[3]/button[1]'
     ).click()
     sleep(1)
     Log().info("添加更多基站ID")
     self.d.find_element_by_css_selector(
         '#index > div.second-container > div.main-wrapper > div > div.tenant-container > div.detail-content > div.content > div.topo > div.network-setting-dialog > div:nth-child(1) > div > div.el-dialog__body > form > div.el-form-item.el-form-item--feedback.is-required > div > button > span'
     ).click()
     sleep(1)
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/div[5]/div[1]/div/div[2]/form/div[2]/div/div[3]/div/input'
     ).send_keys("11111")
     sleep(1)
     try:
         Log().info("点击提交")
         self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/div[5]/div[1]/div/div[3]/div/button[1]/span'
         ).click()
         sleep(1)
         WebDriverWait(
             self.d, 30,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 'body > div.el-message.el-message--success > p'))
         t = self.d.find_element_by_css_selector(
             'body > div.el-message.el-message--success > p').text
         Log().info("配置成功")
         self.d.close()
         return t
     except Exception:
         Log().debug("配置失败")
         screenshot(self.d, 'zuhu')
         raiseout()
コード例 #16
0
ファイル: networklevel.py プロジェクト: manito-666/inms_ui
    def add02(self,name):
        Log().info("引用模版点击添加模版")
        WebDriverWait(self.d, 30, 0.5).until(lambda ele: self.d.find_element_by_xpath('/html/body/div/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/span'))
        self.d.find_element_by_xpath('/html/body/div/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/span').click()

        Log().info("输入模版名称")
        self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[2]/form/div[1]/div/div/input').send_keys(name)
        Log().info("选择专网等级")
        ele= self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[2]/form/div[2]/div/div/label[1]/span[1]/span')
        self.d.execute_script("arguments[0].scrollIntoView(false);", ele)
        self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[2]/form/div[2]/div/div/label[1]/span[1]/span').click()
        sleep(1)
        Log().info("选择专网行业")
        self.d.find_element_by_xpath('/html/body/div[1]/div/div[2]/div[2]/div/div[3]/div/div[2]/form/div[3]/div/div/div[1]/span/span/i').click()
        sleep(1)
        self.d.find_element_by_xpath('/html/body/div[3]/div[1]/div[1]/ul/li[1]').click()
        sleep(1)
        Log().info("点击引用模版")
        WebDriverWait(self.d,60,1).until(lambda ele:self.d.find_element_by_xpath('/html/body/div[1]/div/div[2]/div[2]/div/div[3]/div/div[2]/form/div[4]/div/div/div[1]/form/div[3]/div[2]/div/button'))
        self.d.find_element_by_xpath('/html/body/div[1]/div/div[2]/div[2]/div/div[3]/div/div[2]/form/div[4]/div/div/div[1]/form/div[3]/div[2]/div/button').click()
        sleep(1)
        self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[2]/form/div[4]/div/div/div[2]/div/div[2]/div/div/div[1]/div[2]/div[3]/table/tbody/tr[1]/td[1]/div').click()
        sleep(1)
        self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[2]/form/div[4]/div/div/div[2]/div/div[2]/div/div/div[3]/div[3]/button[1]').click()
        sleep(1)
        Log().info("选择场景")
        self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[2]/form/div[4]/div/div/div[1]/form/div[1]/div/div[1]/div/span/span/i').click()
        sleep(1)
        self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[2]/form/div[4]/div/div/div[1]/form/div[1]/div/div[1]/div/span/span/i').click()
        sleep(1)
        self.d.find_element_by_xpath('/html/body/div[4]/div[1]/div[1]/ul/li[2]').click()
        sleep(1)
        Log().info("选择业务")
        self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[2]/form/div[4]/div/div/div[1]/form/div[2]/div/div[1]/div[1]/span/span/i').click()
        sleep(1)
        self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[2]/form/div[4]/div/div/div[1]/form/div[2]/div/div[1]/div[1]/span/span/i').click()
        sleep(1)
        self.d.find_element_by_xpath('/html/body/div[5]/div[1]/div[1]/ul/li[1]').click()
        sleep(1)
        try:
            Log().info("点击提交")
            WebDriverWait(self.d,30,1).until(lambda ele:self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[3]/div/button[1]'))
            self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[3]/div/div[3]/div/button[1]').click()
            WebDriverWait(self.d, 10, 1).until(lambda ele: self.d.find_element_by_css_selector('body > div.el-message.el-message--success > p'))
            t = self.d.find_element_by_css_selector('body > div.el-message.el-message--success > p').text
            Log().info("添加成功")
            self.d.close()
            return t
        except Exception :
            Log().debug("添加失败")
            screenshot(self.d, 'zhuanwang')
            raiseout()
コード例 #17
0
ファイル: networklevel.py プロジェクト: manito-666/inms_ui
 def select_1(self,name):
     Log().info("输入模版名称查找")
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[1]/div/div/input').send_keys(name)
     sleep(1)
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[4]/div/button[2]').click()
     sleep(1)
     try:
         m=self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr/td[6]/div/button[1]').text
         Log().info("查找成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("查找失败")
         screenshot(self.d, 'zhuanwang')
         raiseout()
コード例 #18
0
 def peizhi_2(self):
     Log().info("点击租户名称")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[1]/td[2]/div/a'
     ).click()
     sleep(1)
     Log().info("点击专网配置")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/button[1]'
     ).click()
     sleep(1)
     Log().info("点击引用模版")
     WebDriverWait(
         self.d, 60, 1
     ).until(lambda ele: self.d.find_element_by_xpath(
         '/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/div[5]/div[1]/div/div[2]/form/div[3]/div/div/div[1]/form/div[3]/div[2]/div/button/span'
     ))
     self.d.find_element_by_xpath(
         '/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/div[5]/div[1]/div/div[2]/form/div[3]/div/div/div[1]/form/div[3]/div[2]/div/button/span'
     ).click()
     sleep(1)
     try:
         Log().info("选择模版")
         self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/div[5]/div[1]/div/div[2]/form/div[3]/div/div/div[2]/div/div[2]/div/div/div[1]/div[2]/div[3]/table/tbody/tr/td[2]/div/label/span/span'
         ).click()
         sleep(1)
         self.d.find_element_by_xpath(
             '/html/body/div[1]/div/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/div[5]/div[1]/div/div[2]/form/div[3]/div/div/div[2]/div/div[2]/div/div/div[3]/div[3]/button[1]'
         ).click()
         sleep(1)
         Log().info("选择场景")
         self.d.find_element_by_css_selector(
             'div.el-dialog__footer:nth-child(3) > div:nth-child(1) > button:nth-child(1)'
         ).click()
         WebDriverWait(
             self.d, 30,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 'body > div.el-message.el-message--success > p'))
         t = self.d.find_element_by_css_selector(
             'body > div.el-message.el-message--success > p').text
         Log().info("配置成功")
         self.d.close()
         return t
     except Exception:
         Log().debug("配置失败")
         screenshot(self.d, 'zuhu')
         raiseout()
コード例 #19
0
 def delete(self):
     Log().info("删除第3个数据")
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[3]/td[5]/div/button[2]').click()
     sleep(1)
     Log().info("点击删除")
     self.d.find_element_by_css_selector('body > div.el-message-box__wrapper > div > div.el-message-box__btns > button.el-button.el-button--default.el-button--small.el-button--primary').click()
     sleep(1)
     try:
         m = self.d.find_element_by_css_selector("body > div.el-message.el-message--success").text
         Log().info("删除成功")
         self.d.close()
         return m
     except Exception :
         Log().debug("删除失败")
         screenshot(self.d, 'mec')
         raiseout()
コード例 #20
0
ファイル: scene.py プロジェクト: manito-666/Unittest_UItest
 def select_hy(self):
     Log().info("选择行业进行查询")
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[2]/div/div/div/span/span/i').click()
     sleep(2)
     self.d.find_element_by_xpath('/html/body/div[2]/div[1]/div[1]/ul/li[1]').click()
     sleep(1)
     try:
         self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[3]/div/button[2]').click()
         sleep(1)
         m = self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[1]/td[5]/div/button[1]').text
         Log().info("查询成功")
         self.d.close()
         return m
     except Exception :
         Log().debug("异常原因:未找到该元素")
         screenshot(self.d, 'changjing')
         raiseout()
コード例 #21
0
 def swith(self):
     Log().info("租户详情页跳转")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr[1]/td[2]'
     ).click()
     sleep(1)
     try:
         m = self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/div[2]/div[2]/button[1]'
         ).text
         Log().info("跳转成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("跳转失败")
         screenshot(self.d, 'zuhu')
         raiseout()
コード例 #22
0
 def pladd(self):
     self.d.find_element_by_xpath(
         '/html/body/div/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/div'
     ).click()
     sleep(1)
     Log().info("点击下载模版")
     try:
         m = self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div/div[2]/form/div[1]/a'
         ).text
         Log().info("下载成功")
         self.d.close()
     except Exception:
         Log().debug("下载失败")
         screenshot(self.d, 'zhongduan')
         raiseout()
     else:
         return m
コード例 #23
0
 def select1(self, name):
     Log().info("根据模版名称查询")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[1]/div/div/input'
     ).send_keys(name)
     sleep(1)
     try:
         self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[6]/div/button[2]'
         ).click()
         m = self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr/td[7]/div/button[2]'
         ).text
         Log().info("查询成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("异常原因:未找到该元素")
         screenshot(self.d, 'qiepian')
         raiseout()
コード例 #24
0
 def add(self, username, beizhu):
     Log().info("点击新建")
     self.d.find_element_by_css_selector(
         "#index > div.second-container > div.main-wrapper > div > div:nth-child(2) > div.add-new > span"
     ).click()
     sleep(1)
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[2]/form/div[1]/div/div/input'
     ).send_keys(username)
     sleep(1)
     Log().info("选择运维角色")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[2]/form/div[2]/div/div[1]/div/span/span/i'
     ).click()
     sleep(1)
     self.d.find_element_by_xpath(
         '/html/body/div[3]/div[1]/div[1]/ul/li[1]').click()
     sleep(1)
     Log().info("输入备注")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[2]/form/div[3]/div/div/textarea'
     ).send_keys(beizhu)
     sleep(1)
     try:
         Log().info("点击提交")
         self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[4]/div/div[3]/div/button[1]'
         ).click()
         WebDriverWait(
             self.d, 10,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 'body > div.el-message.el-message--success > p'))
         t = self.d.find_element_by_css_selector(
             'body > div.el-message.el-message--success > p').text
         Log().info("新建用户成功")
         self.d.close()
         return t
     except Exception:
         Log().debug("异常原因:用户已存在")
         screenshot(self.d, 'xitong')
         raiseout()
コード例 #25
0
 def alter(self):
     Log().info("点击编辑")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr/td[5]/div/button[1]').click()
     sleep(1)
     Log().info("修改url")
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[3]/div/div[2]/form/div[3]/div/div/input').clear()
     sleep(1)
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[3]/div/div[2]/form/div[3]/div/div/input').send_keys("10.7.154.12")
     sleep(1)
     try:
         self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[3]/div/div[3]/div/button[1]').click()
         WebDriverWait(self.d, 10, 1).until(lambda ele: self.d.find_element_by_css_selector('body > div.el-message.el-message--success'))
         t = self.d.find_element_by_css_selector('body > div.el-message.el-message--success').text
         Log().info("修改成功")
         self.d.close()
         return t
     except Exception :
         Log().debug("修改失败")
         screenshot(self.d, 'mec')
         raiseout()
コード例 #26
0
 def select(self, sj):
     Log().info("查询终端用户[手机号]")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[1]/div/div/input'
     ).send_keys(sj)
     sleep(1)
     try:
         self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[6]/div/button[2]'
         ).click()
         sleep(1)
         m = self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr/td[2]'
         ).text
         Log().info("查询成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("异常原因:未找到该元素")
         screenshot(self.d, 'zhongduan')
         raiseout()
コード例 #27
0
 def select_juese(self, name):
     Log().info("选择角色名称查询")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[2]/div/div/div/input'
     ).send_keys(name)
     sleep(1)
     try:
         Log().info("点击查询")
         self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[3]/div/button[2]'
         ).click()
         sleep(1)
         m = self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[3]/div[1]/div[3]/table/tbody/tr[1]/td[5]/div/button[1]/span'
         ).text
         Log().info("查询成功")
         self.d.close()
         return m
     except Exception:
         Log().debug("异常原因:用户不存在")
         screenshot(self.d, 'xitong')
         raiseout()
コード例 #28
0
 def alter(self):
     Log().info("点击编辑默认修改列表第一条数据")
     WebDriverWait(
         self.d, 10, 1
     ).until(lambda ele: self.d.find_element_by_css_selector(
         "#index > div.second-container > div.main-wrapper > div > div:nth-child(2) > div:nth-child(2) > div.table-pagination > div.el-table.el-table--fit.el-table--striped.el-table--enable-row-hover.el-table--enable-row-transition > div.el-table__body-wrapper.is-scrolling-none > table > tbody > tr:nth-child(1) > td.el-table_2_column_18 > div > button:nth-child(1)"
     ))
     self.d.find_element_by_css_selector(
         "#index > div.second-container > div.main-wrapper > div > div:nth-child(2) > div:nth-child(2) > div.table-pagination > div.el-table.el-table--fit.el-table--striped.el-table--enable-row-hover.el-table--enable-row-transition > div.el-table__body-wrapper.is-scrolling-none > table > tbody > tr:nth-child(1) > td.el-table_2_column_18 > div > button:nth-child(1)"
     ).click()
     sleep(1)
     Log().info("修改IMSI")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[3]/div/div[2]/form/div[2]/div/div/input'
     ).send_keys("1111")
     sleep(1)
     Log().info("修改备注")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[3]/div/div[2]/form/div[6]/div/div/textarea'
     ).send_keys("22")
     sleep(1)
     try:
         self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[3]/div/div[3]/div/button[1]'
         ).click()
         WebDriverWait(
             self.d, 10,
             1).until(lambda ele: self.d.find_element_by_css_selector(
                 'body > div.el-message.el-message--success'))
         t = self.d.find_element_by_css_selector(
             'body > div.el-message.el-message--success').text
         Log().info("修改成功")
         self.d.close()
         return t
     except Exception:
         Log().debug("修改失败")
         screenshot(self.d, 'zhongduan')
         raiseout()
コード例 #29
0
 def select_2(self):
     Log().info("选择行业为船舶--等级L1")
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[2]/div/div/div/span/span/i'
     ).click()
     sleep(1)
     WebDriverWait(self.d, 30,
                   0.5).until(lambda ele: self.d.find_element_by_xpath(
                       '/html/body/div[2]/div[1]/div[1]/ul/li[3]'))
     self.d.find_element_by_xpath(
         '/html/body/div[2]/div[1]/div[1]/ul/li[3]').click()
     sleep(1)
     self.d.find_element_by_xpath(
         '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[3]/div/div/div/span/span/i'
     ).click()
     sleep(1)
     WebDriverWait(self.d, 10,
                   1).until(lambda ele: self.d.find_element_by_xpath(
                       '/html/body/div[3]/div[1]/div[1]/ul/li[1]'))
     self.d.find_element_by_xpath(
         '/html/body/div[3]/div[1]/div[1]/ul/li[1]').click()
     sleep(1)
     try:
         Log().info("点击提交")
         self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[4]/div/button[2]'
         ).click()
         sleep(1)
         m = self.d.find_element_by_xpath(
             '//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/div/span'
         ).text
         Log().info("查找成功,该元素不存在")
         self.d.close()
         return m
     except Exception:
         Log().debug("异常原因:该元素存在")
         screenshot(self.d, 'zhuanwang')
         raiseout()
コード例 #30
0
 def select(self):
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[1]/div/div/div/span/span/i').click()
     sleep(1)
     Log().info("选取首个专网租户")
     WebDriverWait(self.d,30,1).until(lambda ele:self.d.find_element_by_xpath('/html/body/div[4]/div[1]/div[1]/ul/li[3]'))
     self.d.find_element_by_xpath('/html/body/div[4]/div[1]/div[1]/ul/li[3]').click()
     WebDriverWait(self.d,30,1).until(lambda ele:self.d.find_element_by_xpath(
        '/html/body/div[4]/div[1]/div[1]/ul/li[2]/span'))
     self.d.find_element_by_xpath('/html/body/div[4]/div[1]/div[1]/ul/li[2]/span').click()
     sleep(1)
     Log().info("选取厂商")
     self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[1]/form/div[2]/div/div/div/span/span/i').click()
     sleep(1)
     self.d.find_element_by_xpath('/html/body/div[3]/div[1]/div[1]/ul/li[4]').click()
     try:
         m=self.d.find_element_by_xpath('//*[@id="index"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr/td[5]/div/button[1]').text
         Log().info("查询成功")
         self.d.close()
         return m
     except Exception :
         Log().info("查询失败")
         screenshot(self.d, 'mec')
         raiseout()