使用frame_to_be_available_and_switch_to_it 找到不到iframe 报错selenium.common.exceptions.TimeoutException:

def waitFrameToBeAvailableAndSwitchToIt(locationType, locatorExprexxion, *args):
    # 检查frame 是否存在,存在则切换进frame控件中
    global waitUtil,driver
    try:
        waitUtil.frameToBeAvailableAndSwitchToIt(locationType, locatorExprexxion)
    except Exception as e:
        raise e
    def frameToBeAvailableAndSwitchToIt(self,locationType,locatorExpression,*arg):
        #检查frame是否存在 存在则切换进frame空间中
        try:
            self.wait.until(
                EC.frame_to_be_available_and_switch_to_it((
                    self.locationTypeDict[locationType.lower()],
                        locatorExpression)))
        except Exception as e:
            #抛出异常信息给上层调用者
            raise e

以下是报错 请大神指点!!!!

Traceback (most recent call last):
  File "G:\KeyWordFromeWork\testScripts\TestSendMailWithAttachment.py", line 296, in TestSendMailWithAttachment
    eval(expressionStr)
  File "<string>", line 1, in <module>
  File "G:\KeyWordFromeWork\action\PageAction.py", line 280, in waitFrameToBeAvailableAndSwitchToIt
    raise e
  File "G:\KeyWordFromeWork\action\PageAction.py", line 278, in waitFrameToBeAvailableAndSwitchToIt
    waitUtil.frameToBeAvailableAndSwitchToIt(locationType, locatorExprexxion)
  File "G:\KeyWordFromeWork\util\WaitUtil.py", line 74, in frameToBeAvailableAndSwitchToIt
    raise e
  File "G:\KeyWordFromeWork\util\WaitUtil.py", line 71, in frameToBeAvailableAndSwitchToIt
    locatorExpression)))
  File "G:\py\pyanzhuagn\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:

猜你喜欢

转载自blog.csdn.net/super_ike/article/details/89380479