Skip to content

Select Frame break for iframes in IE8 32bit / Win 7 #12

Closed

Description

@adwu73

Try this script

Set Log Level TRACE
Open Browser http://fancybox.net/home ie
click element id=various5
Select Frame id=fancybox-frame
Close All Browsers

You will notice that iframe fancybox-frame has been opened, and can be located in IE Dev Tools, however, Select Frame keywords break with following error and trace info:

KEYWORD: Selenium2Library.Select Frame id=fancybox-frame
Documentation: Sets frame identified by locator as current frame.

Start / End / Elapsed: 20111202 21:58:10.427 / 20111202 21:58:11.489 / 00:00:01.062

+KEYWORD: Selenium2Library.Capture Page Screenshot
Documentation: Takes a screenshot of the current page and embeds it into the log.
Start / End / Elapsed: 20111202 21:58:10.724 / 20111202 21:58:11.489 / 00:00:00.765

21:58:10.443 TRACE Arguments: [ u'id=fancybox-frame' ]
21:58:10.443 INFO Selecting frame 'id=fancybox-frame'.
21:58:10.443 DEBUG POST http://127.0.0.1:51969/session/393b64e2-054d-4c35-8ca7-78a2bf67c307/elements {"using": "id", "sessionId": "393b64e2-054d-4c35-8ca7-78a2bf67c307", "value": "fancybox-frame"}
21:58:10.708 DEBUG GET http://127.0.0.1:51969/session/393b64e2-054d-4c35-8ca7-78a2bf67c307/element/d9730baa-de31-4bd3-acc3-edc0ebb25eb1/name {"sessionId": "393b64e2-054d-4c35-8ca7-78a2bf67c307", "id": "d9730baa-de31-4bd3-acc3-edc0ebb25eb1"}
21:58:11.489 FAIL ValueError: Element locator 'id=fancybox-frame' did not match any elements.
21:58:11.489 DEBUG Traceback (most recent call last):
File "", line 2, in select_frame
File "C:\Python27\lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 12, in _run_on_failure_decorator
return method(_args, *_kwargs)
File "C:\Python27\lib\site-packages\Selenium2Library\keywords_browsermanagement.py", line 157, in select_frame
element = self._element_find(locator, True, True, tag='frame')
File "C:\Python27\lib\site-packages\Selenium2Library\keywords_element.py", line 502, in _element_find
raise ValueError("Element locator '" + locator + "' did not match any elements.")

Activity

  1. adwu73 commented on Dec 2, 2011

    @adwu73
    ContributorAuthor

    I have tested a slight different script with FF, I found this issue exist on FF as well. Try this script:

    Set Log Level TRACE
    Open Browser http://fancybox.net/home firefox
    click element id=various5
    sleep 5
    click element id=various5
    Select Frame id=fancybox-frame
    Close All Browsers

  2. adwu73 commented on Dec 2, 2011

    @adwu73
    ContributorAuthor

    I found out that the issue may lies in this code here in _browsermanagement.py around line 170:

    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)
    

    I change the
    element = self._element_find(locator, True, True, tag='frame')

  3. adwu73 commented on Dec 2, 2011

    @adwu73
    ContributorAuthor

    to
    element = self._element_find(locator, True, True, tag='iframe')

    helped to pass the IE8 & FF test. I think the logic here has to be modified to handle both tags frame & iframe. Hope this can be helpful. I will change all tag='frame" to tag='iframe' and try to move forward, since my real apps use iframe only. I didn't know the python detail enough to provide the right code, sorry! Hope some one can fix this!

  4. adwu73 commented on Dec 2, 2011

    @adwu73
    ContributorAuthor

    above fix also make following test scripts pass:

    Set Log Level TRACE
    Open Browser http://fancybox.net/home ie
    click element id=various5
    Select Frame id=fancybox-frame
    Page Should Contain Button id=jq-downloadBtn
    Click Button id=jq-downloadBtn
    Close All Browsers

  5. adwu73 commented on Dec 21, 2011

    @adwu73
    ContributorAuthor

    The fix is provided in issue 23, close this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions