问题:
switch_to.frame()进入frame会报错要操作的元素截图如下:
我想点击“游戏用户”,但是用switch_to.frame()进入frame就会报错
我的代码:
- fr_1=driver.find_elements_by_xpath("//frame[@name='topFrame']")
- driver.switch_to.frame(fr_1)
- 报错信息:
- Traceback (most recent call last):
- File "C:\Users\CT\Desktop\Python\AdminWeb.py", line 42, in <module>
- LoginTest.gameyonghu()
- File "C:\Users\CT\Desktop\Python\AdminWeb.py", line 36, in gameyonghu
- driver.switch_to.frame(fr_1)
- File "C:\Python35\lib\site-packages\selenium\webdriver\remote\switch_to.py", line 87, in frame
- self._driver.execute(Command.SWITCH_TO_FRAME, {'id': frame_reference})
- File "C:\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
- self.error_handler.check_response(response)
- File "C:\Python35\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
- raise exception_class(message, screen, stacktrace)
- selenium.common.exceptions.NoSuchFrameException: Message: frame id has unexpected type
复制代码
|