Hi,

I've been able to implement screen-capture on exception using the above
mentioned approach. I added this wrapper to the same custom webdriver class
mentioned in the thread [01].

Now web-driver captures and saves screen-shots to
*/target/surefire-reports/screen-shot
*location when an exception is thrown by the webdriver.

[01]  [ES- Integration Test] Custom WebDriver Class for UI test Automation

Thanks!
- Ayesha

On Fri, Oct 31, 2014 at 1:21 PM, Ayesha Dissanayaka <aye...@wso2.com> wrote:

> Hi Krishantha,
>
> Thank you for the quick response. I'll tryout the approach you have
> suggested.
>
> Thanks!
> - Ayesha
>
> On Fri, Oct 31, 2014 at 1:03 PM, Krishantha Samaraweera <
> krishan...@wso2.com> wrote:
>
>> Hi Ayesha,
>>
>> I think you try out with EventFiringWebDriver and WebDriverEventListener
>> to wrap your webdriver instance. This will capture screenshot for
>> exceptions thrown by webdriver.
>>
>> EventFiringWebDriver driver = new EventFiringWebDriver(new
>> InternetExplorerDriver());
>> WebDriverEventListener errorListener = new
>> AbstractWebDriverEventListener() {
>>     @Override
>>     public void onException(Throwable throwable, WebDriver driver) {
>>         takeScreenCapture("screen-name"); //you need to implement this
>> method.
>>     }
>> };
>>
>> driver.register(errorListener);
>>
>>
>> Thanks,
>> Krishantha.
>>
>> On Fri, Oct 31, 2014 at 12:25 PM, Ayesha Dissanayaka <aye...@wso2.com>
>> wrote:
>>
>>> Hi,
>>>
>>> In-order to identify UI test failures in automation test execution what
>>> would be the best approach?
>>> Some Suggestions are as below which I have come across.
>>>
>>>    - Use a TestNG listener [01] to capture the current screen on a test
>>>    failure.
>>>    - try-catch in asserts and bind screen-capturing to error handling
>>>    - Any other proper way?
>>>
>>> [01]
>>> http://blog.alvarus.org/2014/05/selenium-capturing-screenshots-of-failed-tests-in-junit-and-testng/
>>>
>>> Thanks!
>>> - Ayesha
>>> --
>>> *Ayesha Dissanayaka*
>>> Software Engineer,
>>> WSO2, Inc : http://wso2.com
>>> <http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
>>> 20, Palmgrove Avenue, Colombo 3
>>> E-Mail: aye...@wso2.com <ayshsa...@gmail.com>
>>>
>>
>>
>>
>> --
>> Krishantha Samaraweera
>> Senior Technical Lead - Test Automation
>> Mobile: +94 77 7759918
>> WSO2, Inc.; http://wso2.com/
>> lean . enterprise . middlewear.
>>
>
>
>
> --
> *Ayesha Dissanayaka*
> Software Engineer,
> WSO2, Inc : http://wso2.com
> <http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
> 20, Palmgrove Avenue, Colombo 3
> E-Mail: aye...@wso2.com <ayshsa...@gmail.com>
>



-- 
*Ayesha Dissanayaka*
Software Engineer,
WSO2, Inc : http://wso2.com
<http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
20, Palmgrove Avenue, Colombo 3
E-Mail: aye...@wso2.com <ayshsa...@gmail.com>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to