import sys
import time
from basepage.browser_engine import BrowserEngine
from basepage.logger import Logger
from basepage.read_config import ReadConfig


class CheckGsjd(BrowserEngine):
    __log_name = 'check_gsjd'

    def __init__(self, log_name=__log_name):
        super().__init__(log_name)
        self._driver = self.login_znfz()

    # 选择审查起诉
    def choose_gsjd(self):
        # tags = driver.find_element_by_xpath('/html/body/div[1]/div/section/aside/div/ul/li[3]/a/span')
        tags = self._driver.find_element_by_xpath('/html/body/div[1]/div/section/aside/div/ul/li[3]')
        # print(tags.text)
        self.logger.info("tags.text:%s" % tags.text)
        tags.click()
        time.sleep(10)
        return self._driver

    # 选择审查起诉案件
    # def choose_gsjd_case(self):
    #     caseId = self.get_caseId('caseId')
    #     self.logger.info("the caseId : %s" % caseId)
    #     # driver.find_element_by_xpath('/html/body/div[1]/div/section/section/main/div/div[2]/div/div/div[1]/form/div[1]/div[3]/input').send_keys(caseId)
    #     self._driver.find_element_by_xpath('//*[@id="ajmc"]').send_keys(caseId)
    #     # 点击按钮
    #     self._driver.find_element_by_xpath(
    #         '/html/body/div[1]/div/section/section/main/div/div[2]/div/div/div[1]/form/div[2]/div/button[2]').click()
    #     time.sleep(5)
    #     # 点击办理
    #     tags = self._driver.find_element_by_xpath(
    #         '/html/body/div[1]/div/section/section/main/div/div[2]/div/div/div[2]/div[2]/div/div/div/div/div/div[2]/table/tbody/tr/td[7]/p/a')
    #     # print(tags.text)
    #     self.logger.info("tags.text:%s" % tags.text)
    #     tags.click()
        # driver.find_element_by_tag_name(tags.text).click()



# if __name__ == '__main__':
#     test = CheckGsjd()
#     driver = test.choose_gsjd()
#     test.choose_gsjd_case(driver)
#     '''
#     conf = ReadConfig()
#     caseId = conf.get_caseId('caseId')
#     logger.info("the caseId : %s" % caseId)
#     # driver.find_element_by_xpath('/html/body/div[1]/div/section/section/main/div/div[2]/div/div/div[1]/form/div[1]/div[3]/input').send_keys(caseId)
#     driver.find_element_by_xpath('//*[@id="ajmc"]').send_keys(caseId)
#     # 点击按钮
#     driver.find_element_by_xpath(
#         '/html/body/div[1]/div/section/section/main/div/div[2]/div/div/div[1]/form/div[2]/div/button[2]').click()
#     # 点击办理
#     #tags = driver.find_element_by_xpath('/html/body/div[1]/div/section/section/main/div/div[2]/div/div/div[2]/div[2]/div/div/div/div/div/div[2]/table/tbody/tr/td[7]/p/a')
#     time.sleep(5)
#     tags = driver.find_element_by_xpath('/html/body/div[1]/div/section/section/main/div/div[2]/div/div/div[2]/div[2]/div/div/div/div/div/div[2]/table/tbody/tr/td[3]/p/span')
#     print(tags.text)
#     tags.click()
#     #links = driver.find_element_by_tag_name("办理")
#     #print(links.text)
#     #tags.click()
#     #print (tags.text)
#     #tags.click()
#     '''
