@Test
public void detectsIfWebdriverReportedInvalidSelectorError() {
assertFalse(Cleanup.of.isInvalidSelectorError(null));
assertFalse(Cleanup.of.isInvalidSelectorError(new WebDriverException("Ups!")));
assertTrue(Cleanup.of.isInvalidSelectorError(new InvalidSelectorException("Wrong xpath")));
assertTrue(Cleanup.of.isInvalidSelectorError(new WebDriverException("An invalid or illegal string was specified\n")));
assertTrue(Cleanup.of.isInvalidSelectorError(new WebDriverException("invalid element state: Failed to execute query: '//input[:attr='al]' is not a valid selector.\n")));
assertTrue(Cleanup.of.isInvalidSelectorError(new WebDriverException("Invalid selectors: //input[:attr='al]")));
assertTrue(Cleanup.of.isInvalidSelectorError(new WebDriverException("{\"errorMessage\":\"SYNTAX_ERR: DOM Exception 12\",,\"post\":\"{\\\"using\\\":\\\"css selector\\\",\\\"value\\\":\\\"//input[:attr='al]\\\"}\"}}\n")));
assertTrue(Cleanup.of.isInvalidSelectorError(new WebDriverException("{\"errorMessage\":\"Unable to locate an element with the xpath expression //xxx[@' because of the following error:\\nError: INVALID_EXPRESSION_ERR: DOM XPath Exception 51\"}}\n")));