How to integrate @Extension (ScreenshotExtension) with Spring

9 views
Skip to first unread message

Juan Carlos Canal

unread,
Mar 17, 2020, 1:11:16 PM3/17/20
to concordion
Hi,

I am integrating a Selenium Spring framework with concordion. I´m using ScreenshotExtension to capture errors:

@Autowired
    protected WebDriver driver;

@Extension
    public ConcordionExtension extension = new ScreenshotExtension()
    .setScreenshotTaker(new SeleniumScreenshotTaker(driver)).setScreenshotOnAssertionFailure(true)
    .setMaxWidth(400);

On the other hand, i am configuring webdriver with @Bean.

My problem is: When I launch the test @Extension is loaded before Spring Context and this causes a NullPointerException in ScreenshotTaker class.

How can I solve this problem?

Thanks in advance!

Nigel Charman

unread,
Mar 18, 2020, 5:46:46 AM3/18/20
to conco...@googlegroups.com
Hi

Have you tried deferring setting the screenshot taker on the extension until after the driver is constructed? It's been a while since I've looked at that code, but it might work.

Nigel
--
You received this message because you are subscribed to the Google Groups "concordion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to concordion+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/concordion/c1aef876-5f82-4f35-aff8-549ac59505a8%40googlegroups.com.

Juan Carlos Canal

unread,
Mar 26, 2020, 12:05:16 AM3/26/20
to concordion
Hi Nigel:

Thanks for your support!

I´ve tried to defer setting the screenshot taker but then the screenshots are captured from my dektop instead of the browser...

Juan Carlos Canal


El miércoles, 18 de marzo de 2020, 10:46:46 (UTC+1), Nigel Charman escribió:
Hi

Have you tried deferring setting the screenshot taker on the extension until after the driver is constructed? It's been a while since I've looked at that code, but it might work.

Nigel

On 18/03/20 12:23 am, Juan Carlos Canal wrote:
Hi,

I am integrating a Selenium Spring framework with concordion. I´m using ScreenshotExtension to capture errors:

@Autowired
    protected WebDriver driver;

@Extension
    public ConcordionExtension extension = new ScreenshotExtension()
    .setScreenshotTaker(new SeleniumScreenshotTaker(driver)).setScreenshotOnAssertionFailure(true)
    .setMaxWidth(400);

On the other hand, i am configuring webdriver with @Bean.

My problem is: When I launch the test @Extension is loaded before Spring Context and this causes a NullPointerException in ScreenshotTaker class.

How can I solve this problem?

Thanks in advance!
--
You received this message because you are subscribed to the Google Groups "concordion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conco...@googlegroups.com.

Nigel Charman

unread,
Mar 29, 2020, 4:09:48 AM3/29/20
to conco...@googlegroups.com
Hi

Are you able to send me a cutdown version of your project? That will help me reproduce it and try out a few things.

Nigel
To unsubscribe from this group and stop receiving emails from it, send an email to concordion+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/concordion/cfcaf904-8c95-4693-9471-9f0cd4025151%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages