python - AttributeError: MyRemote instance has no attribute 'assertEqual'
高洛峰
高洛峰 2017-04-18 09:31:48
0
1
531
class MyRemote:
     def FFO_Backup_Delete(self,cc_ip,FFO_name):
        self.FFO_Backup_Stop(cc_ip,FFO_name)
        self.driver = webdriver.Firefox()
        self.driver.implicitly_wait(30)
        self.base_url = "http://" + cc_ip + ":58080"
        self.verificationErrors = []
        self.accept_next_alert = True
        driver = self.driver
        driver.maximize_window()
        driver.get(self.base_url + "/i2/std-index.php?")
        driver.find_element_by_id("userName").clear()
        driver.find_element_by_id("userName").send_keys("admin")
        driver.find_element_by_id("password").clear()
        driver.find_element_by_id("password").send_keys("admin")
        driver.find_element_by_id("login_sub").click()
        driver.find_element_by_id("op_type_login").click()
        driver.find_element_by_id("upgrade_button").click()
        driver.find_element_by_xpath("//p[@id='sidebar']/dl[5]/dt/p").click()
        driver.find_element_by_id("fsp_coopy").click()
        result = self.FFO_execute_select_sql(cc_ip,FFO_name)
        ffo_uuid = result[0][0]
        fsp_process_id = "ffo" + ffo_uuid
        time.sleep(10)
        ffo_status = driver.find_element_by_xpath("//td[@id='" + fsp_process_id + "']/p").get_attribute('status')
        if ffo_status == "FSP_COMPLETED":
            print "vvvvvvvvvv"
            driver.find_element_by_xpath("//input[@class='checkbox2' and @value='" + ffo_uuid + "']").click()
            driver.find_element_by_xpath("//p[@id='main']/p/p[2]/p/a[2]/span").click()
            driver.find_element_by_css_selector("button.aui_state_highlight").click()
            self.assertEqual(u"'" + FFO_name + "'任务正在运行中,您确定要删除吗?", self.close_alert_and_get_its_text())
            driver.find_element_by_css_selector("button.aui_state_highlight").click()
            driver.find_element_by_link_text(u"退出").click()
            driver.find_element_by_css_selector("button.aui_state_highlight").click()
            driver.close()
        else:
            driver.find_element_by_xpath("//input[@class='checkbox2' and @value='" + ffo_uuid + "']").click()
            driver.find_element_by_xpath("//p[@id='main']/p/p[2]/p/a[2]/span").click()
            driver.find_element_by_css_selector("button.aui_state_highlight").click()
            driver.find_element_by_link_text(u"退出").click()
            driver.find_element_by_css_selector("button.aui_state_highlight").click()
            driver.close()

执行报错提示:
AttributeError: MyRemote instance has no attribute 'assertEqual'
这是什么错误啊,请前辈赐教

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
巴扎黑

self.assertEqual()
This sentence directly calls the self.assertEqual method.
However, self.assertEqual was not defined before this.
Define first, then use.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template