Commit 5fc7c457 authored by Henrik Skupin's avatar Henrik Skupin
Browse files

Bug 1684827 - [wdspec] Fix switch to frame tests for "no such element" error...

Bug 1684827 - [wdspec] Fix switch to frame tests for "no such element" error instead of "stale element reference". r=webdriver-reviewers,jgraham, a=jcristau

Element references are per browsing context. As such
elements as found within a frame are not existent in
any parent browsing context, and when retrieving these
a "no such element" error has to be returned.

Depends on D100878

Differential Revision: https://phabricator.services.mozilla.com/D101065
parent 0a956a90
......@@ -2,7 +2,7 @@ import pytest
import webdriver.protocol as protocol
from webdriver import StaleElementReferenceException
from webdriver import NoSuchElementException
from webdriver.transport import Response
from tests.support.asserts import assert_error, assert_same_element, assert_success
......@@ -96,9 +96,9 @@ def test_frame_id_null(session):
response = switch_to_frame(session, None)
assert_success(response)
with pytest.raises(StaleElementReferenceException):
with pytest.raises(NoSuchElementException):
element2.text
with pytest.raises(StaleElementReferenceException):
with pytest.raises(NoSuchElementException):
element1.text
frame = session.find.css("iframe", all=False)
......
import pytest
from webdriver import StaleElementReferenceException
from webdriver import NoSuchElementException
from tests.support.asserts import assert_error, assert_success
from tests.support.inline import inline, iframe
......@@ -67,13 +67,13 @@ def test_switch_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)
element = session.find.css("p", all=False)
result = switch_to_parent_frame(session)
assert_success(result)
with pytest.raises(StaleElementReferenceException):
stale_element.text
with pytest.raises(NoSuchElementException):
element.text
def test_switch_from_top_level(session):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment