Capture js using Firefox profile
1| Download the library file, JSErrorCollector
2| Add to build path.
3| Make use of the library in your code using Firefox profile.
Snippet
import java.util.List;
import net.jsourcerer.webdriver.jserrorcollector.JavaScriptError;
import org.openqa.selenium.firefox.FirefoxProfile;
@BeforeTest
public void setUp() throws Exception {
FirefoxProfile ffProfile = new FirefoxProfile();
JavaScriptError.addExtension(ffProfile);
driver = new FirefoxDriver(ffProfile);
baseUrl = "http://xyz.com";
}
@Test
public void contentTitle() throws Exception {
driver.get(baseUrl + "/");
Thread.sleep(5000);
}
@AfterTest
public void tearDown() throws Exception {
List<JavaScriptError> jsErrors = JavaScriptError.readErrors(driver);
System.out.println("——————START displaying JS errors——————");
for (int i = 0; i < jsErrors.size(); i++) {
System.out.println(jsErrors.get(i).getErrorMessage());
System.out.println("Error in Line: "+ jsErrors.get(i).getLineNumber());
System.out.println(jsErrors.get(i).getSourceName());
System.out.println("\n");
}
System.out.println("——————STOP displaying JS errors———————");
driver.close();
driver.quit();
}
Exposing privileged or cross-origin callable is prohibited error when doing it
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteIs this usable only for selenium JAVA and not for Python?
ReplyDeleteif try to use provided .xpi file as extension ,it says corrupted
ReplyDeleteIt’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read.
ReplyDeleteMachine Learning Training in Chennai |Machine Learning Training Institute in Chennai
It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read.
ReplyDeleteData science Course Training in Chennai |Best Data Science Training Institute in Chennai
RPA Course Training in Chennai |Best RPA Training Institute in Chennai
AWS Course Training in Chennai |Best AWS Training Institute in Chennai
off white
ReplyDeletegolden goose shoes
curry 7
curry 7 sour patch
kd 12
kd shoes
bape hoodie
yeezy boost 350 v2
golden goose
kd shoes
Thanks for the blog article.Much thanks again. Fantastic.
ReplyDeletedot net online training hydarabad
dot net online training india
jordan shoes
ReplyDeleteoff white
chrome hearts