Capture Page Screenshot' could not be run on failure

808 views
Skip to first unread message

mahsa mokaberian

unread,
Jun 13, 2021, 7:58:59 AM6/13/21
to robotframework-users
I get the following  error and I can't see the screenshot in Log file. 
Capture Page Screenshot' could not be run on failure: NoSuchWindowException: Message: Browsing context has been discarded   Capture.PNG

Dave Amies

unread,
Jun 13, 2021, 9:28:35 PM6/13/21
to robotframework-users
Hi Mahsa,

The error is pretty clear, the reason there is no screenshot is because robot framework's connection to the browser is broken, and this probably explains why the main step failed as well.

So what happened? most likely the browser crashed, but you will need to investigate, here are some questions to help you start investigating what happened:
- was this test running on your local machine or somewhere else? 
- did you see what happened when the test stopped? 
- after you got this error was the browser still running? 
- are you running the latest version of your browser and webdriver?
- Which robot framework library are you using? SeleniumLibrary or BrowserLibrary? do you have the latest version?

Hopefully these questions will lead you to finding your problem,

Dave.

mahsa mokaberian

unread,
Jun 14, 2021, 12:43:55 AM6/14/21
to robotframework-users
Hi Dave

- was this test running on your local machine or somewhere else?  Test is running on server. I remote on it.
- did you see what happened when the test stopped? Yes. I wrote fail test for testing the screenshot. 
- after you got this error was the browser still running? Yes
- are you running the latest version of your browser and webdriver? Yes. Both of them are up to date.
- Which robot framework library are you using? SeleniumLibrary or BrowserLibrary? do you have the latest version? Selenium Library (Latest Version)

I Uninstalled and re-Install the Firefox, but the problem has not be solved.
Would you please help me?

Dave Amies

unread,
Jun 14, 2021, 8:18:21 PM6/14/21
to robotframework-users
Hi Mahsa,

I will try to help, I don't usually use FF, so i've not seen this, but we can try to figure this out.

Can you give me some idea of the steps before this failure? Particularly did you close a browser tab?
 
Does it always fail at the same place or just randomly anywhere in the test? trying to work out if's a crash type of behaviour. If it is the webdriver crashing you should see something on the command window/terminal.

BTW which os are you on?

Just to help you understand what appears to be happening (my understanding, though i'm not the developer of any of these components), there is a chain of components that goes something like this:
robot framework -> selenium library -> selenium -> webdriver -> firefox

The error message you screen shot appears to be coming from selenium library, its saying that selenium has lost contact with the browser session, but it's not clear if the connection was lost between selenium and webdriver or between webdriver and firefox

so to solve this issue we need to work out why the connection was lost and none of these are actually part of robot framework, they are just used by robot framework.

Dave.

mahsa mokaberian

unread,
Jun 15, 2021, 2:25:48 AM6/15/21
to robotframework-users
Thanks for your help and support. The problem has been solved.

Dave Amies

unread,
Jun 15, 2021, 7:42:57 PM6/15/21
to robotframework-users
Great news, out of curiosity what was the problem in the end?

Dave.

Reply all
Reply to author
Forward
0 new messages