diff --git a/build.gradle b/build.gradle deleted file mode 100644 index f69d26b..0000000 --- a/build.gradle +++ /dev/null @@ -1,13 +0,0 @@ -group 'io.testable' -version '0.1.0-SNAPSHOT' - -apply plugin: 'java' - -repositories { - mavenCentral() -} - -dependencies { - compile group:'io.testable', name: 'testable-selenium-java', version: '0.0.3' - testCompile group: 'junit', name: 'junit', version: '4.11' -} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..776a3cc --- /dev/null +++ b/pom.xml @@ -0,0 +1,51 @@ + + + 4.0.0 + io.testable + selenium-java-example + 0.0.1-SNAPSHOT + + + io.testable + testable-selenium-java + 0.0.12 + + + org.testng + testng + 6.14.3 + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + + + + io.testable.selenium.TestableExample + + + + + jar-with-dependencies + + + + + + + + + + diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 8369239..0000000 --- a/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -rootProject.name = 'testable-selenium-java-example' - diff --git a/src/main/java/io/testable/selenium/TestableExample.java b/src/main/java/io/testable/selenium/TestableExample.java index 7c19de8..dd911eb 100644 --- a/src/main/java/io/testable/selenium/TestableExample.java +++ b/src/main/java/io/testable/selenium/TestableExample.java @@ -2,6 +2,14 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeOptions; +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.DesiredCapabilities; + +import java.util.Collections; +import java.util.logging.Level; /** * Simple example of loading Google and taking a screenshot in a way that is compatible with the Testable platform. @@ -9,10 +17,19 @@ public class TestableExample { public static void main(String[] args) { - ChromeOptions options = new ChromeOptions(); + LoggingPreferences logPrefs = new LoggingPreferences(); + logPrefs.enable(LogType.PERFORMANCE, Level.ALL); + DesiredCapabilities options = DesiredCapabilities.chrome(); + options.setCapability("goog:loggingPerfs", Collections.singletonMap(LogType.BROWSER, Level.ALL.toString())); WebDriver driver = TestableSelenium.newWebDriver(options); driver.get("https://www.google.com"); TestableSelenium.takeScreenshot(driver, "temp.png"); + + LogEntries logEntries = driver.manage().logs().get(LogType.BROWSER); + for (LogEntry entry : logEntries) { + System.out.println(entry.toString()); + } + driver.close(); }