def test8(self): '''提交数据''' self.formid = BasicAction.preview(self.driver) self.driver.find_element_by_css_selector("[type='file']").send_keys( "%s\\1.jpg" % os.getcwd()) sleep(1) self.driver.find_element_by_id('btnSubmit').click() sleep(1) if 'F4' in DataUtils.verify_data(url, self.formid): self.assertEqual('1.jpg', DataUtils.verify_data(url, self.formid)['F4'], '提交数据失败') else: self.assertEqual(1, 0, '提交数据失败')
def test13(self): '''提交数据''' self.formid = BasicAction.preview(self.driver) self.driver.find_element_by_xpath('//*[@id="fields"]/li/div/input').send_keys('1122') self.driver.find_element_by_id('btnSubmit').click() sleep(1) self.assertEqual('1122',DataUtils.verify_data(url, self.formid)['F1'],'提交数据失败')
def test9(self): '''提交数据''' self.formid = BasicAction.preview(self.driver) self.driver.find_element_by_css_selector('[class="xxl province input fld"]').click() self.driver.find_element_by_xpath('//*[@id="fields"]/li/div/span[1]/select/option[2]').click() self.driver.find_element_by_id('btnSubmit').click() sleep(1) self.assertEqual('北京市',DataUtils.verify_data(url, self.formid)['F2'],'提交数据失败')
def test8(self): '''提交数据''' self.formid = BasicAction.preview(self.driver) self.driver.find_element_by_xpath('//span/i[5]').click() self.driver.find_element_by_id('btnSubmit').click() sleep(1) self.assertEqual(5, DataUtils.verify_data(url, self.formid)['F1'], '提交数据失败')
def test11(self): '''提交数据''' self.formid = BasicAction.preview(self.driver) self.driver.find_element_by_css_selector('[for="t2"]').click() self.driver.find_element_by_id('btnSubmit').click() sleep(1) self.assertEqual('选项 1', DataUtils.verify_data(url, self.formid)['F1'], '提交数据失败')
def test10(self): '''提交数据''' self.formid = BasicAction.preview(self.driver) js = "$('label').eq(2).click();$('#btnSubmit').click()" self.driver.execute_script(js) sleep(1) self.assertEqual('选项 1', DataUtils.verify_data(url, self.formid)['F1'], '提交数据失败')
def test6(self): '''提交数据''' self.driver.find_element_by_id("addNoImgGoods").click() self.driver.find_element_by_class_name('goods-name-view').click() SettingOptUtils.pgoods(self.driver) self.formid = BasicAction.preview(self.driver) self.driver.find_element_by_id('btnSubmit').click() sleep(1) self.assertEqual(2.0,DataUtils.verify_data(url, self.formid)['F1'],'提交数据失败')
def test9(self): '''提交数据''' self.formid = BasicAction.preview(self.driver) self.driver.find_element_by_xpath( '//*[@id="fields"]/li/div/select').click() self.driver.find_element_by_css_selector('[value="选项 1"]').click() self.driver.find_element_by_id('btnSubmit').click() sleep(1) self.assertEqual('选项 1', DataUtils.verify_data(url, self.formid)['F1'], '提交数据失败')
def test6(self): '''提交数据''' self.driver.find_element_by_id("fileToUpload").send_keys("%s\\2.jpg" % os.getcwd()) sleep(1) self.driver.find_element_by_id("goodsList").click() SettingOptUtils.pgoods(self.driver) self.formid = BasicAction.preview(self.driver) self.driver.find_element_by_id('btnSubmit').click() sleep(1) self.assertEqual(2.0, DataUtils.verify_data(url, self.formid)['F1'], '提交数据失败')
def test11(self): '''提交数据''' self.formid = BasicAction.preview(self.driver) self.driver.find_element_by_css_selector( '[class="yyyy input fld"]').send_keys('2018') self.driver.find_element_by_css_selector( '[class="mm input fld"]').send_keys('08') self.driver.find_element_by_css_selector( '[class="dd input fld"]').send_keys('20') self.driver.find_element_by_id('btnSubmit').click() sleep(1) self.assertEqual('2018-08-20', DataUtils.verify_data(url, self.formid)['F1'], '提交数据失败')
def test7(self): '启用IP黑名单' self.driver.find_element_by_css_selector( '[id="dailytimelimit"]').clear() self.driver.find_element_by_css_selector( '[for="chkIPcontrol"]').click() self.driver.find_element_by_css_selector( '[name="IPBLACKLIST"]').send_keys( DataUtils.verify_data(url, self.formid)['IP']) BasicAction.view(self.driver, self.formid, url) self.driver.find_element_by_id('btnSubmit').click() self.assertIn( '禁止', self.driver.find_element_by_css_selector( '[class="error-content"]').text, '启用IP黑名单修改失败')