python - AttributeError: MyRemote instance has no attribute 'assertEqual'
高洛峰
高洛峰 2017-04-18 09:31:48
0
1
535
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教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

모든 응답(1)
巴扎黑

self.assertEqual()
이 문장은 self.assertEqual 메소드를 직접 호출합니다.
그러나 이전에는 self.assertEqual이 정의되지 않았습니다.
먼저 정의한 후 사용하세요.

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿