Is there a way to avoid screenshots?

HI All,

I have some tasks that navigate through various sites, one of these sites that most tasks goes to requires a login (always the same userid), but as i’m reusing the browser for the suite of tasks so if a previous task already logged in, when I return to the site, my login is retained.

At the moment I do the following to detect wait for the page to load and detect if i’m logged in:

	${dologin} =	Run Keyword And Return Status	Wait Until Page Contains 	Login

If it’s the first task to load the site the login runs as soon as the page loads, if not the script continues after 5 seconds timeout and this works well for me, the only problem is I get a screen shot every time.

What I would like to know, is there a way to tell the selenium library not to take a screen shot for only the next keyword? or some way to turn on and off the screenshots?

In some other places where I need to test for a condition I use Get WebElements which doesn’t take a screen shot but it runs immediately and doesn’t have a timeout allowing time for the element to load.

Also are there other keywords in SeleniumLibrary that don’t take screenshots?

Dave.

Have you seen this https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Run-on-failure%20functionality

1 Like

Hi Tatu,
I hadn’t seen that, thanks I will try it.
Dave.

Hi Tatu,

Thank you very much, that solved my issue.

Dave.

1 Like

Hi, could you please let me know, where to add run_on_failure=Nothing""?

It depends where you need it, in my case I put it just before the logon keyword and just after I put it back to default, what you need to do will depend on your AUT.

Dave.

Hi,
I’m trying to use the keyword run_on_failure and set it to nothing but it says that the keyword is not defined, anyone have any idea what’s the issue? I’m just curious about the problem here.
Also btw I solved the issue with the screenshots following this article which might be a neater solution.
https://www.formulatedautomation.com/post/how-to-avoid-huge-log-files-in-robot-framework

Hi Mohamed,

perhaps No Operation is what you want.

Dave.