python - AttributeError: MyRemote instance has no attribute 'assertEqual'

 潇潇小姐姐cherryhv_309 发布于 2022-10-27 20:33
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'
这是什么错误啊,请前辈赐教

1 个回答
  • self.assertEqual()
    这句直接调用了 self.assertEqual 方法。
    然而,在此之前却没有定义 self.assertEqual 。
    要先定义,后使用。

    2022-10-29 02:10 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有