def test_element_list_raises_when_element_first_doesnt_exists_in_element_context(
    browser,
    app_url,
):
    "element list raises exception with right information in element context"
    browser.visit(app_url)
    with pytest.raises(ElementDoesNotExist) as err:
        element_list = browser.find_by_css("#inside").find_by_css(
            ".inner-element-that-dont-exists",
        )
        assert "css" == element_list.find_by
        assert ".inner-element-that-dont-exists" == element_list.query
        element_list.first

    expected_message = 'No elements were found with css ".inner-element-that-dont-exists"'

    assert expected_message == err.value.args[0]
element list raises exception with right information in element context
tests/tests_webdriver/test_element_does_not_exist.py