@@ -84,7 +84,7 @@ public void ShouldNotBeAbleToLocateByIdMultipleElementsThatDoNotExist()
8484 public void FindingASingleElementByEmptyIdShouldThrow ( )
8585 {
8686 driver . Url = formsPage ;
87- Assert . That ( ( ) => driver . FindElement ( By . Id ( "" ) ) , Throws . InstanceOf < NoSuchElementException > ( ) ) ;
87+ Assert . That ( ( ) => driver . FindElement ( By . Id ( "" ) ) , Throws . InstanceOf < WebDriverException > ( ) ) ;
8888 }
8989
9090 [ Test ]
@@ -222,7 +222,7 @@ public void ShouldNotBeAbleToLocateByTagNameMultipleElementsThatDoNotExist()
222222 public void FindingASingleElementByEmptyTagNameShouldThrow ( )
223223 {
224224 driver . Url = formsPage ;
225- Assert . That ( ( ) => driver . FindElement ( By . TagName ( "" ) ) , Throws . InstanceOf < NoSuchElementException > ( ) ) ;
225+ Assert . That ( ( ) => driver . FindElement ( By . TagName ( "" ) ) , Throws . InstanceOf < WebDriverException > ( ) ) ;
226226 }
227227
228228 [ Test ]
@@ -312,14 +312,14 @@ public void ShouldNotFindElementByClassWhenTheNameQueriedIsShorterThanCandidateN
312312 public void FindingASingleElementByEmptyClassNameShouldThrow ( )
313313 {
314314 driver . Url = xhtmlTestPage ;
315- Assert . That ( ( ) => driver . FindElement ( By . ClassName ( "" ) ) , Throws . InstanceOf < NoSuchElementException > ( ) ) ;
315+ Assert . That ( ( ) => driver . FindElement ( By . ClassName ( "" ) ) , Throws . InstanceOf < WebDriverException > ( ) ) ;
316316 }
317317
318318 [ Test ]
319319 public void FindingMultipleElementsByEmptyClassNameShouldThrow ( )
320320 {
321321 driver . Url = xhtmlTestPage ;
322- Assert . That ( ( ) => driver . FindElements ( By . ClassName ( "" ) ) , Throws . InstanceOf < NoSuchElementException > ( ) ) ;
322+ Assert . That ( ( ) => driver . FindElements ( By . ClassName ( "" ) ) , Throws . InstanceOf < WebDriverException > ( ) ) ;
323323 }
324324
325325 [ Test ]
@@ -600,28 +600,28 @@ public void ShouldNotFindElementsByCssSelectorWhenThereIsNoSuchElement()
600600 public void FindingASingleElementByEmptyCssSelectorShouldThrow ( )
601601 {
602602 driver . Url = xhtmlTestPage ;
603- Assert . That ( ( ) => driver . FindElement ( By . CssSelector ( "" ) ) , Throws . InstanceOf < NoSuchElementException > ( ) ) ;
603+ Assert . That ( ( ) => driver . FindElement ( By . CssSelector ( "" ) ) , Throws . InstanceOf < WebDriverException > ( ) ) ;
604604 }
605605
606606 [ Test ]
607607 public void FindingMultipleElementsByEmptyCssSelectorShouldThrow ( )
608608 {
609609 driver . Url = xhtmlTestPage ;
610- Assert . That ( ( ) => driver . FindElements ( By . CssSelector ( "" ) ) , Throws . InstanceOf < NoSuchElementException > ( ) ) ;
610+ Assert . That ( ( ) => driver . FindElements ( By . CssSelector ( "" ) ) , Throws . InstanceOf < WebDriverException > ( ) ) ;
611611 }
612612
613613 [ Test ]
614614 public void FindingASingleElementByInvalidCssSelectorShouldThrow ( )
615615 {
616616 driver . Url = xhtmlTestPage ;
617- Assert . That ( ( ) => driver . FindElement ( By . CssSelector ( "//a/b/c[@id='1']" ) ) , Throws . InstanceOf < NoSuchElementException > ( ) ) ;
617+ Assert . That ( ( ) => driver . FindElement ( By . CssSelector ( "//a/b/c[@id='1']" ) ) , Throws . InstanceOf < WebDriverException > ( ) ) ;
618618 }
619619
620620 [ Test ]
621621 public void FindingMultipleElementsByInvalidCssSelectorShouldThrow ( )
622622 {
623623 driver . Url = xhtmlTestPage ;
624- Assert . That ( ( ) => driver . FindElements ( By . CssSelector ( "//a/b/c[@id='1']" ) ) , Throws . InstanceOf < NoSuchElementException > ( ) ) ;
624+ Assert . That ( ( ) => driver . FindElements ( By . CssSelector ( "//a/b/c[@id='1']" ) ) , Throws . InstanceOf < WebDriverException > ( ) ) ;
625625 }
626626
627627 // By.linkText positive
0 commit comments