[wdspec] Fix switch to frame tests for "no such element" error instead of "stale element reference".

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1684827
gecko-commit: 697e1305e91b8af353916fd09b5e103bb25f28fc
gecko-reviewers: webdriver-reviewers, jgraham
diff --git a/webdriver/tests/switch_to_frame/switch.py b/webdriver/tests/switch_to_frame/switch.py
index 07994be..df7e5b7 100644
--- a/webdriver/tests/switch_to_frame/switch.py
+++ b/webdriver/tests/switch_to_frame/switch.py
@@ -2,7 +2,7 @@
 
 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
@@ -90,9 +90,9 @@
     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)
diff --git a/webdriver/tests/switch_to_parent_frame/switch.py b/webdriver/tests/switch_to_parent_frame/switch.py
index e05e119..9c6db8d 100644
--- a/webdriver/tests/switch_to_parent_frame/switch.py
+++ b/webdriver/tests/switch_to_parent_frame/switch.py
@@ -1,6 +1,6 @@
 import pytest
 
-from webdriver import StaleElementReferenceException
+from webdriver import NoSuchElementException
 
 from tests.support.asserts import assert_error, assert_success
 
@@ -66,13 +66,13 @@
     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, inline):