pyalarmdotcom.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:alfred-alarmcom 作者: schwark 项目源码 文件源码
def state(self):
        """
        Check the current status of the alarm system.
        """
        # Click the refresh button to verify the state if it was made somewhere else
        try:
            # Recheck the current status
            self._driver.get(self._driver.current_url)
            current_status = WebDriverWait(self._driver, self.timeout).until(EC.presence_of_element_located((self.STATUS_IMG[0],
                                                   self.STATUS_IMG[1]))).text
            _LOGGER.debug('Fetched current status from system: {}'.format(current_status))
            return current_status
        except (exceptions.NoSuchElementException, exceptions.NoSuchWindowException, exceptions.TimeoutException, urllib.error.URLError) as e:
            _LOGGER.warning('Error while checking alarm status. Attempting login again.')
            self._login()
            current_status = WebDriverWait(self._driver, self.timeout).until(EC.presence_of_element_located((self.STATUS_IMG[0],
                                                   self.STATUS_IMG[1]))).text
            return current_status
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号