Revision dfc6293bd278f46fb6963950157a4f19b281dca4 authored by Ms2ger on 14 March 2018, 16:45:25 UTC, committed by Ms2ger on 14 March 2018, 16:45:25 UTC
1 parent e3d85ce
Raw File
switch_to_parent_frame.py
import pytest
from webdriver import StaleElementReferenceException

from tests.support.inline import inline, iframe


def switch_to_parent_frame(session):
    return session.transport.send("POST", "session/%s/frame/parent" % session.session_id)


def test_stale_element_from_iframe(session):
    session.url = inline(iframe("<p>foo"))
    frame_element = session.find.css("iframe", all=False)
    session.switch_frame(frame_element)
    stale_element = session.find.css("p", all=False)
    switch_to_parent_frame(session)
    with pytest.raises(StaleElementReferenceException):
        stale_element.text
back to top