Hi all!
I use WebDriver to automate the test packets. Please help to solve one problem: does not work use the jQuery .. always get the error
org.openqa.selenium.WebDriverException: TypeError: $(...) is null
Testing code:
@Test
public void stage003() throws Exception {
Reporter.log("<p class=\"stageDescr\">Check for uniqueness of identifiers</p>");
JQSS("" +
"var D_id=\"\";" +
"$('[id]').each(function(){" +
"var ids = $('[id=\"'+this.id+'\"]');" +
"if(ids.length>1 && ids[0]==this) {" +
"D_id = D_id + \" \" + this.id;" +
"}" +
"});" +
"if (D_id==\"\") {" +
"return D_id = \"All ID's is unique\";" +
"} else {" +
"return D_id;" +
"}" +
"");
Reporter.log("<p class=\"stageOutline\"> </p>");
}
And
public void JQSS(String SC) {
String test = (String)((JavascriptExecutor) driver).executeScript(
SC
);
Reporter.log("<p>Testing report... "+test+ "</p>");
}
PS: jquery on the page is already connected