File tree Expand file tree Collapse file tree 2 files changed +40
-143
lines changed
py/test/selenium/webdriver/common Expand file tree Collapse file tree 2 files changed +40
-143
lines changed Original file line number Diff line number Diff line change @@ -34,11 +34,8 @@ def test_should_find_element_by_xpath(self):
34
34
def test_should_not_find_element_by_xpath (self ):
35
35
self ._load_page ("nestedElements" )
36
36
element = self .driver .find_element_by_name ("form2" )
37
- try :
37
+ with pytest . raises ( NoSuchElementException ) :
38
38
element .find_element_by_xpath ("select/x" )
39
- self .fail ("Expected NoSuchElementException to have been thrown" )
40
- except NoSuchElementException as e :
41
- pass
42
39
43
40
def test_finding_dot_slash_elements_on_element_by_xpath_should_find_not_top_level_elements (self ):
44
41
self ._load_simple_page ()
@@ -101,11 +98,8 @@ def test_should_find_element_by_id_when_multiple_matches_exist(self):
101
98
def test_should_find_element_by_id_when_no_match_in_context (self ):
102
99
self ._load_page ("nestedElements" )
103
100
element = self .driver .find_element_by_id ("test_id_div" )
104
- try :
101
+ with pytest . raises ( NoSuchElementException ) :
105
102
element .find_element_by_id ("test_id_out" )
106
- self .fail ("Expected NoSuchElementException to have been thrown" )
107
- except NoSuchElementException as e :
108
- pass
109
103
110
104
def test_should_find_element_by_link_text (self ):
111
105
self ._load_page ("nestedElements" )
You can’t perform that action at this time.
0 commit comments