Skip to content

Commit 702c12a

Browse files
committed
[py]: more unit test coverage for script keys
1 parent 4440ea0 commit 702c12a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

py/test/selenium/webdriver/common/script_pinning_tests.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17+
import re
1718

1819
import pytest
1920

2021
from selenium.common.exceptions import JavascriptException
22+
from selenium.webdriver.remote.script_key import ScriptKey
2123

2224

2325
def test_should_allow_script_pinning(driver, pages):
@@ -67,3 +69,10 @@ def test_calling_unpinned_script_causes_error(driver, pages):
6769
driver.unpin(cheese)
6870
with pytest.raises(JavascriptException):
6971
driver.execute_script(cheese)
72+
73+
74+
def test_unpinning_non_existing_script_raises(driver, pages):
75+
pages.load("simpleTest.html")
76+
with pytest.raises(KeyError, match=re.escape(r"No script with key: ScriptKey(id=1) existed in {}")):
77+
driver.unpin(ScriptKey(1))
78+

0 commit comments

Comments
 (0)