Download Selenium : How To Capture JS Errors In Google Chrome - Software Testing Tutorials graphic type that can be scaled to use with the Silhouette Cameo or Cricut. An SVG's size can be increased or decreased without a loss of quality. All of our downloads include an image, Silhouette file, and SVG file. It should be everything you need for your next project. Our SVG files can be used on adhesive vinyl, heat transfer and t-shirt vinyl, or any other cutting surface
package Testing_Pack;
import java.util.logging.Level;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.logging.LogEntries;
import org.openqa.selenium.logging.LogEntry;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.logging.LoggingPreferences;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class LogErrorInChrome {
WebDriver driver;
@BeforeMethod
public void setUp() {
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver_win32\\chromedriver.exe");
DesiredCapabilities cap = DesiredCapabilities.chrome();
// Set logging preference In Google Chrome browser capability to log
// browser errors.
LoggingPreferences pref = new LoggingPreferences();
pref.enable(LogType.BROWSER, Level.ALL);
cap.setCapability(CapabilityType.LOGGING_PREFS, pref);
driver = new ChromeDriver(cap);
}
// Function to capture JSError log.
public void GetJSErrosLog() {
// Capture all JSerrors and print In console.
LogEntries jserrors = driver.manage().logs().get(LogType.BROWSER);
for (LogEntry error : jserrors) {
System.out.println(error.getMessage());
}
}
@Test
public void testMethod() {
driver.get("http://only-testing-blog.blogspot.com/2015/01/table-with-checkbox.html");
// Call GetJSErrosLog() to log and print JSErrors In console.
GetJSErrosLog();
}
}
Console result of above example will looks like bellow.
Download Selenium : How To Capture JS Errors In Google Chrome - Software Testing Tutorials All SVG file downloads also come bundled with DXF, PNG, and EPS file formats. All designs come with a small business commercial license. These SVG cut files are great for use with Silhouette Cameo or Cricut and other Machine Tools.