the keyword "select frame " dose not work well
The key word 'select frame' can't recoginze iframes which are dynamic genrerated by Ajax.
I tried selenium2 python binding it works fine.
so I checked source code (_browsermanagement.py) and made some change,then, It worked. I wonder the function of the two lines ( I can't find the realizition of _element_find.) #element = self._element_find(locator, True, True, tag='frame') #self._current_browser().switch_to_frame(element)
def select_frame(self, locator):
"""Sets frame identified by `locator` as current frame.
Key attributes for frames are `id` and `name.` See `introduction` for
details about locating elements.
"""
self._info("Selecting frame '%s'." % locator)
#element = self._element_find(locator, True, True, tag='frame')
#self._current_browser().switch_to_frame(element)
self._current_browser().switch_to_frame(locator)
I also faced the same situation. The issue is in
element = self._element_find(locator, True, True, tag='frame')
in tag='frame'
because in class ElementFinder no logic to handle frame tag
def _get_tag_and_constraints(self, tag): if tag is None: return None, {}
tag = tag.lower()
constraints = {}
if tag == 'link':
tag = 'a'
elif tag == 'image':
tag = 'img'
elif tag == 'list':
tag = 'select'
elif tag == 'radio button':
tag = 'input'
constraints['type'] = 'radio'
elif tag == 'checkbox':
tag = 'input'
constraints['type'] = 'checkbox'
elif tag == 'text field':
tag = 'input'
constraints['type'] = 'text'
elif tag == 'file upload':
tag = 'input'
constraints['type'] = 'file'
return tag, constraints
Therefore need to hack code to make it work, like this
element = self._element_find(locator, True, True)
Please see the fix in issue 21 for this iframe issue
@lucasliu @polusok @adwu73 : This issue has been fixed in #71.