0

I am using BrowserStack along with Nightwatch as testing framework. In Nightwatch test I took screenshot using "saveScreenshot" Selenium command. Screenshot is saved by BrowserStack on CDN. I want that screenshot URL for my custom reporting.

I got one solution, which is get current(test) sessions logs and parse that logs to get screenshot(s) URL(s). Which is tedious task. In single test for multiple "saveScreenshot" command calls its also difficult to map which URL corresponds to which page(May be "hcode" value in response will solve it but not sure).

Can you please suggest how to achieve my goal ?

user2618875
  • 859
  • 2
  • 8
  • 22

1 Answers1

0

Yes, if you wish to fetch the screenshot URLs, the only way you can do it would be by parsing the session logs that are fetched using the REST API. You'll also need the session ID of the test to fetch the session logs, for which you can refer this question.

Additional points that can help you:

  1. You can check the Python script here, for more details on parsing the logs to get the screenshot URLs

  2. The browser.saveScreenshot('<path>/Screenshot.png'); in Nightwatch, also saves the screenshot to your local machine which you can use for reporting. You can name the screenshots accordingly so that it will help you understand at what point of the test was the screenshot captured.

Community
  • 1
  • 1
Umang Sardesai
  • 742
  • 5
  • 13