Skip to content

Commit

Permalink
Correcting error handling in .NET finding of elements
Browse files Browse the repository at this point in the history
This commit removes the `IllegalLocatorException`. This exception was only
thrown when finding by class name where the class name contained
whitespace. It is redundant, and now `InvalidSelectorException` is thrown
in its place. This commit also corrects the element finding tests to
expect the proper `InvalidSelectorException` when finding by tag name,
where the tag name provided is an empty string.
  • Loading branch information
jimevans committed Jan 22, 2016
1 parent 19f5284 commit b4330a4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 80 deletions.
75 changes: 0 additions & 75 deletions dotnet/src/webdriver/IllegalLocatorException.cs

This file was deleted.

1 change: 0 additions & 1 deletion dotnet/src/webdriver/WebDriver.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@
<Compile Include="IHasInputDevices.cs" />
<Compile Include="IJavascriptExecutor.cs" />
<Compile Include="IKeyboard.cs" />
<Compile Include="IllegalLocatorException.cs" />
<Compile Include="ILocatable.cs" />
<Compile Include="IMouse.cs" />
<Compile Include="INavigation.cs" />
Expand Down
8 changes: 4 additions & 4 deletions dotnet/test/common/ElementFindingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ public void ShouldNotBeAbleToLocateByTagNameMultipleElementsThatDoNotExist()
public void FindingASingleElementByEmptyTagNameShouldThrow()
{
driver.Url = formsPage;
Assert.Throws<NoSuchElementException>(() => driver.FindElement(By.TagName("")));
Assert.Throws<InvalidSelectorException>(() => driver.FindElement(By.TagName("")));
}

[Test]
public void FindingMultipleElementsByEmptyTagNameShouldThrow()
{
driver.Url = formsPage;
Assert.Throws<NoSuchElementException>(() => driver.FindElements(By.TagName("")));;
Assert.Throws<InvalidSelectorException>(() => driver.FindElements(By.TagName("")));;
}

[Test]
Expand Down Expand Up @@ -305,7 +305,7 @@ public void FindingMultipleElementsByEmptyClassNameShouldThrow()
public void FindingASingleElementByCompoundClassNameShouldThrow()
{
driver.Url = xhtmlTestPage;
Assert.Throws<IllegalLocatorException>(() => driver.FindElement(By.ClassName("a b")));
Assert.Throws<InvalidSelectorException>(() => driver.FindElement(By.ClassName("a b")));
}

[Test]
Expand All @@ -314,7 +314,7 @@ public void FindingASingleElementByCompoundClassNameShouldThrow()
public void FindingMultipleElementsByCompoundClassNameShouldThrow()
{
driver.Url = xhtmlTestPage;
Assert.Throws<IllegalLocatorException>(() => driver.FindElements(By.ClassName("a b")));
Assert.Throws<InvalidSelectorException>(() => driver.FindElements(By.ClassName("a b")));
}

[Test]
Expand Down

0 comments on commit b4330a4

Please sign in to comment.