def sourcing_search(): a=['*****@*****.**','*****@*****.**','*****@*****.**'] Uname=["$%^&&&","45611%^","dad&^"] lo=login_init.loginpage() so=Sourcing_init.sourcing() Un=Pm_affiliate_search.affiliatesearch() chromedriver="D:\Program Files (x86)\Chrome\chromedriver.exe" os.environ["webdriver.chrome.driver"] = chromedriver browser = webdriver.Chrome(chromedriver) # Get local session of firefox browser.maximize_window() browser.get("http://192.168.1.20:9999") # Load page assert "login" in browser.title browser.implicitly_wait(2) Means.login(browser, '*****@*****.**', '123456') assert "System Integration" in browser.title lo.rolechosered(browser).click() time.sleep(2) so.sour(browser).click() time.sleep(1) Un.affiliateSearchfunction(browser).click() Un.Searchaffiliatename(browser).send_keys("@#$^&*^") time.sleep(1) Un.searchbutton(browser).click() ndata=Un.shownodata(browser).text if ndata=="No Data": print "输入特殊字符@¥@¥¥,返回值为No Data,此处没有BUG" Result_te.rest("输入特殊字符@¥@¥¥,返回值为No Data,此处没有BUG") else: print"输入特殊字符@#¥¥,返回值应为No Data!---此处有BUG" browser.get_screenshot_as_file("D:/svn_QA/Screeshot/sourcingsearch.jpg") # Sendemail.send_mail(a,'ting Auto test',u'输入特殊字符@#¥¥,返回值应为No Data!---此处有BUG') emailimage.AutoSendMail(u"输入特殊字符@#¥¥,返回值应为No Data!---此处有BUG,且附件是发送异常时的截图!请参考。"+"\n"+"感谢指导","D:\\svn_QA\Screeshot\sourcingsearch.jpg") testlog.logsys("输入特殊字符@#¥¥,返回值应为No Data!---此处有BUG", "---有BUG") Result_te.rest("输入特殊字符@#¥¥,返回值应为No Data!---此处有BUG") browser.close() #sourcing_search()
def newaffiliate(self): getrole = login_init.loginpage() getaffiliate = Pm_affiliate_search.affiliatesearch() affiliatedetail = Pm_affiliateDetail.affiliatedetail() chromedriver = "D:\Program Files (x86)\Chrome\chromedriver.exe" os.environ["webdriver.chrome.driver"] = chromedriver browser = webdriver.Chrome(chromedriver) # Get local session of firefox browser.maximize_window() try: browser.get("http://192.168.1.20:9999") # Load page assert "login" in browser.title browser.implicitly_wait(2) Means.login(browser, "*****@*****.**", "123456") assert "System Integration" in browser.title getrole.rolechosecm(browser).click() assert "http://192.168.1.20:9999/affiliate/cm/dashboard_index.html" in browser.current_url getaffiliate.affiliatesearchlist(browser).click() assert "Affiliate List" in browser.title time.sleep(1) getaffiliate.affiliateNew(browser).click() assert "http://192.168.1.20:9999/affiliate/CommonPages/affiliate_create.html" in browser.current_url affiliatedetail.LegalName(browser).send_keys("element test") affiliatedetail.DBAname(browser).send_keys("DBA Name") affiliatedetail.EntityType(browser).click() time.sleep(1) affiliatedetail.EntityTypeLLP(browser).click() assert "LLP" in affiliatedetail.EntityTypeLLP(browser).text affiliatedetail.State(browser).click() time.sleep(1) affiliatedetail.StateAS(browser).click() except Exception as e: print e msg = traceback.format_exc() testlog.logsys("运行失败", "控件没找到!" + msg) browser.close()