MarkusBernhardt / robotframework-selenium2library-java

Java port of the Selenium 2 (WebDriver) Python library for Robot Framework
Apache License 2.0
46 stars 48 forks source link

Screenshot capture isn't working when running tests with Maven from command line #24

Closed Hi-Fi closed 11 years ago

Hi-Fi commented 11 years ago

When run is made from RIDE using custom script that launches tests with Maven, screenshots are captured OK.

Getting following error:

com.github.markusbernhardt.selenium2library.Selenium2Library.Capture Page Screenshot
08:22:40.024    FAIL    NullPointerException
08:22:40.024    DEBUG   java.lang.NullPointerException
    at com.github.markusbernhardt.selenium2library.utils.Robotframework.getPathname(Robotframework.java:53)
    at com.github.markusbernhardt.selenium2library.utils.Robotframework.getLinkPath(Robotframework.java:12)
    at com.github.markusbernhardt.selenium2library.keywords.Screenshot.capturePageScreenshot(Screenshot.java:25)
    at com.github.markusbernhardt.selenium2library.keywords.Screenshot.capturePageScreenshot(Screenshot.java:19)
    at robot.libraries.BuiltIn$py.run_keyword$75(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\libraries\BuiltIn.py:1102)
    at robot.libraries.BuiltIn$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\libraries\BuiltIn.py)
    at com.github.markusbernhardt.selenium2library.keywords.RunOnFailure.runOnFailure(RunOnFailure.java:55)
    at com.github.markusbernhardt.selenium2library.Selenium2Library.runOnFailureByAspectJ(Selenium2Library.java:95)
    at com.github.markusbernhardt.selenium2library.aspects.RunOnFailureAspect.ajc$afterThrowing$com_github_markusbernhardt_selenium2library_aspects_RunOnFailureAspect$1$28ae5ef9(RunOnFailureAspect.aj:21)
    at com.github.markusbernhardt.selenium2library.keywords.Waiting.waitUntilPageContainsElement(Waiting.java:83)
    at robot.model.testcase$py.visit$7(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\testcase.py:65)
    at robot.model.testcase$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\testcase.py)
    at robot.model.itemlist$py.visit$9(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\itemlist.py:54)
    at robot.model.itemlist$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\itemlist.py)
    at robot.model.visitor$py.visit_suite$2(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\visitor.py:22)
    at robot.model.visitor$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\visitor.py)
    at robot.model.testsuite$py.visit$19(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\testsuite.py:152)
    at robot.model.testsuite$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\testsuite.py)
    at robot.model.itemlist$py.visit$9(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\itemlist.py:54)
    at robot.model.itemlist$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\itemlist.py)
    at robot.model.visitor$py.visit_suite$2(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\visitor.py:22)
    at robot.model.visitor$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\visitor.py)
    at robot.model.testsuite$py.visit$19(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\testsuite.py:152)
    at robot.model.testsuite$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\testsuite.py)
    at robot.model.itemlist$py.visit$9(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\itemlist.py:54)
    at robot.model.itemlist$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\itemlist.py)
    at robot.model.visitor$py.visit_suite$2(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\visitor.py:22)
    at robot.model.visitor$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\visitor.py)
    at robot.model.testsuite$py.visit$19(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\testsuite.py:152)
    at robot.model.testsuite$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\model\testsuite.py)
    at robot.run$py.main$3(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\run.py:391)
    at robot.run$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\run.py)
    at robot.utils.application$py._execute$10(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\utils\application.py:88)
    at robot.utils.application$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\utils\application.py)
    at robot.utils.application$py.execute_cli$5(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\utils\application.py:45)
    at robot.utils.application$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\utils\application.py)
    at robot.run$py.run_cli$7(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\run.py:415)
    at robot.run$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\run.py)
    at robot.jarrunner$py._run$3(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\jarrunner.py:60)
    at robot.jarrunner$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\jarrunner.py)
    at robot.jarrunner$py.run$2(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\jarrunner.py:53)
    at robot.jarrunner$py.call_function(C:\workspace\robotframework\tmp-jar-dir\Lib\robot\jarrunner.py)
    at org.robotframework.RobotFramework.run(RobotFramework.java:62)
    at org.robotframework.mavenplugin.AcceptanceTestMojo.executeRobot(AcceptanceTestMojo.java:73)
    at org.robotframework.mavenplugin.AcceptanceTestMojo.subclassExecute(AcceptanceTestMojo.java:68)
    at org.robotframework.mavenplugin.AbstractMojoWithLoadedClasspath.execute(AbstractMojoWithLoadedClasspath.java:52)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
MarkusBernhardt commented 11 years ago

I think what's happening is that Logging.getLogDir() can't find the log dir configuration. Could you please try to set the Log File or the Output Directory at the maven plugin config. This should not be necessary, because the default values should work, but who knows.

Hi-Fi commented 11 years ago

Removing NONE from config allows saving of screenshots. Problem is, that both log and report are set to NONE, because generation of those takes too much memory (known issue in Robotframework (http://robotframework.org/MavenPlugin/#About_memory_usage)).

Code actually has part that handles "null" logDir, which just needs to be extended to handle also "NONE" logDir.

MarkusBernhardt commented 11 years ago

Do you need a release?

Hi-Fi commented 11 years ago

Release would be nice, but we can wait for it, too, if there's some other changes/fixes coming.

MarkusBernhardt commented 11 years ago

Will be in 1.2.0.13. Closing for now.

Hi-Fi commented 11 years ago

Could you make the release, if there isn't any other issues coming? Would be helpful for CI server runs.

MarkusBernhardt commented 11 years ago

Yes sure. Tried that last week. Somehow the upgrade to Oracle JDK 1.7 breaks the release at my Mac. Will look into that at the weekend.

Am 19.07.2013 um 10:55 schrieb Juho Saarinen notifications@github.com:

Could you make the release, if there isn't any other issues coming? Would be helpful for CI server runs.

— Reply to this email directly or view it on GitHub.

Hi-Fi commented 11 years ago

Maybe release should be made using Java 6. At least I think this screenshot logging is still bigger problem than missing capability to instrument library (because instrumentation isn't used currently at the development of library itself).