How do I handle pyqt no response?

Viewed 38

I made a program using pyqt and selenium. While executing the code, there was no response, so I specified the thread, but I don't think I can get the cache value from another class.

Here's the error message:

TypeError: 'cached_property' object is not callable

I searched a lot. I can't find the answers I want, so I'm posting questions. I'm sorry.

class Thread(QThread):
    def __init__(self, parent):
        super().__init__(parent)
        self.parent = parent

    def run(self):
        # 최대 시간 설정(10분)
        max_time_end = time.time() + (60 * 10)
        driver = Example.driver()

        # 조건 : 예매 날짜 예약 페이지 진입
        # 조건 충족 시 까지 반복
        while max_time_end > time.time():
            try:
                # 예매 날짜 예약 페이지
                driver.refresh()
                time.sleep(0.5)

                driver.switch_to.window(driver.window_handles[1])  # 탭 번호(위치)
                driver.find_element(By.XPATH,
                                    f"/html/body/div/div[3]/div/table/tbody/tr[{Example.start.date}]/td[5]/a/img").click()  # 새 탭으로 열기
                break

            except Exception as error:
                print(error, "예매 날짜 예약 페이지 오류")
                continue

        while True:
            # 조건 충족 후 예매 페이지 안내 팝업창 닫기
            try:
                Example.driver.switch_to.window(Example.driver.window_handles[1])  # 탭 번호(위치)
                Example.driver.find_element(By.XPATH, "/html/body/div[8]/div/div/div/span/a/img").click()
                break

            except Exception as error:
                print(error, "예매 대기 중 및 오류")
                continue


    class Example(QMainWindow, Ui_MainWindow):
        def __init__(self):
            super().__init__()
            self.setupUi(self)
            # 프로그램이 항상 최상단에 위치하도록 지정(크롬에 가리지 않게)
            self.setWindowFlags(Qt.WindowStaysOnTopHint)
            self.show()
    
    
        @cached_property
        def driver(self):
            driver = webdriver.Chrome(line)
            return driver
0 Answers
Related