Home > database >  Robot framework and selenium with python - screenshot automatic name change
Robot framework and selenium with python - screenshot automatic name change

Time:01-24

I am using robot framework as the main test framework with selenium ( python libraries) to test web ui. I'm having issues with continuous integration in Jenkins and need to change the screenshot name (that is being assigned automatically with index (selenium-screenshot-{index}.png) to more unique name for several test cases eq.:

${TEST NAME}-screen-{index}.png

I know how to access automatic varibales, but how do I set the automatic generation name to something other than selenium-screenshot on Suite Setup/ beggining of the tests level?

Tried using Set Screenshot Directory to make it more unique for test suites but filenames are still the issue. Also using keyword to capture screenshot and setting the name there is not enough, as some keywords make screenshots on failure and they are still being named with selenium-screenshot convention.

CodePudding user response:

Also using keyword to capture screenshot and setting the name there is not enough, as some keywords make screenshots on failure and they are still being named with selenium-screenshot convention.

You could create your own custom keyword that would handle naming and run on failure. You could use Register Keyword To Run On Failure in Suite Setup to specify which keyword to run on failure.

  • Related