Done! with this:
try{
driver.findElement(By.xpath(".//*[@id='reserva']")).click();
}
catch (Exception e) {
takeScreenshot(driver,e);
}
finally {
driver.close();
}
It works!
El lunes, 11 de diciembre de 2017, 10:31:39 (UTC+1), Ana MB escribió:
>
> Well,... I've realized that it can't be work if the test fails because in
> this case, the tests doesn't finish and doesn't call to "takeScreenshot()"
> method in the code....
>
> So... what could be the solution to take a screenshot of a webpage in case
> the test fails???
>
> Thanks so much!!!!
>
>
> El jueves, 7 de diciembre de 2017, 13:27:32 (UTC+1), Ana MB escribió:
>>
>> But it work only when a test is SUCCESS.
>> I need it when a test is FAILED,...... and I'm not able to get it.
>>
>> I've tried with this conditions, but it doesn't work and I don't
>> understand why...
>>
>>
>> <https://lh3.googleusercontent.com/-1JLoAG4PVX4/Wikzhx6OrMI/AAAAAAAAAM4/ikT27KqUEhwa4VugKhOog247tsXTe8U7wCLcBGAs/s1600/Screenshot_5.jpg>
>>
>>
>> My test result is the following:
>>
>>
>> <https://lh3.googleusercontent.com/-KW1uPaEPmjw/WikznFYzOKI/AAAAAAAAAM8/KDtDdRZpP8s48-UAQbI3NoZ-ZAuWNLDGACLcBGAs/s1600/Screenshot_4.jpg>
>>
>>
>> Any help, please? :(
>>
>>
>> El jueves, 7 de diciembre de 2017, 12:12:43 (UTC+1), Ana MB escribió:
>>>
>>> I've written the following to my test case java file:
>>>
>>> String actualTest = this.getClass().getName()+"."
>>> +testname.getMethodName();
>>> File scrFile =
>>> ((TakesScreenshot)FabricaWebDriver.getDriver()).getScreenshotAs(OutputType.FILE);
>>> FileUtils.copyFile(scrFile, new File("target/screenshots/"+actualTest+
>>> ".png"));
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> And it work!
>>>
>>>
>>>
>>>
>>> El jueves, 7 de diciembre de 2017, 11:10:09 (UTC+1), Ana MB escribió:
>>>>
>>>> I show you another picture of the fail execution of the plugin:
>>>>
>>>>
>>>> <https://lh3.googleusercontent.com/-gNkwmwIF-lc/WikTU1ZzRvI/AAAAAAAAAMo/nAeXDsWrEzEf1q8s7kwB0dx1ZBFHslJOQCLcBGAs/s1600/Screenshot_2.jpg>
>>>>
>>>> Could anybody help me? Thanks guys!!!!
>>>>
>>>>
>>>> El jueves, 7 de diciembre de 2017, 9:54:46 (UTC+1), Ana MB escribió:
>>>>>
>>>>> I've tried with this plugin:
>>>>> https://wiki.jenkins.io/display/JENKINS/UI+Test+Capture+Plugin
>>>>> But I can't configure it, it doesn't let me do it... why? I show you
>>>>> in the picture:
>>>>>
>>>>>
>>>>> <https://lh3.googleusercontent.com/-_zFSgmSZ2Ok/WikBoY6-V7I/AAAAAAAAAMY/7Bj0UE83mDAaEQIsyWiLtSvruEQ8Q6--QCLcBGAs/s1600/Screenshot_1.jpg>
>>>>> Does anybody knows why?
>>>>>
>>>>> Thanks so much for your help!
>>>>>
>>>>>
>>>>> El martes, 5 de diciembre de 2017, 13:34:37 (UTC+1), Ana MB escribió:
>>>>>>
>>>>>> I need some shell command to take a screenshoot and save in some
>>>>>> directory.
>>>>>> How could be that shell code?
>>>>>>
>>>>>> Thanks so much!!
>>>>>>
>>>>>> El martes, 5 de diciembre de 2017, 13:24:27 (UTC+1), Ana MB escribió:
>>>>>>>
>>>>>>> Hi guys!
>>>>>>>
>>>>>>> Does anybody know how to capture the html/url before an error appear
>>>>>>> in the test case??
>>>>>>> I need to know the previous URL, and I don't know how...
>>>>>>>
>>>>>>> Thanks so much for your help!!!
>>>>>>>
>>>>>>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/d6c7cff4-89c4-488d-952e-3c438835e13c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.