Sauce Labs takes screenshots during tests, to make it easier to understand what's happening to the browser. Not all commands will trigger a screenshot; primarily, they're taken for commands that are very likely to change the state of the page.
Which commands trigger screenshots?
Verb | Command | Test Script Action |
---|---|---|
POST | session | Creating a new WebDriver session |
GET | screenshot | Asking Selenium to take a Screenshot |
POST | url | Having the browser open a new page directly |
POST | forward | Going "forward" in browser history |
POST | back | Going "backward" in browser history |
POST | execute | Executing Javascript |
DELETE | window | Closing a browser window |
POST | click | Clicking an element (Without ActionChains) |
POST | submit | Submitting a form |
POST | value | Updating an input field's value |
POST | clear | Clearing an input field's value |
POST | selected | Selecting a radio button |
POST | toggle | Toggling a check box |
POST | hover | Hovering over an element |
POST | drag | Dragging the moust |
POST | orientation | Changing the screen orientation |
POST | perform | Performing an ActionChain |
POST | flick | Flick on a touchscreen using finger controls |
POST | move | Moving the mouse |
POST | up | Swiping a finger up the screen |
POST | down | Swiping a finger down the screen |
POST | longclick | Long press on a touchscreen using finger controls |
DELETE | session | Closing the session |
How do I use the table?
Because there are so many Selenium bindings and tools, it's not possible to give a comprehensive list of which test methods call which Selenium methods. Thankfully, it's easy to figure out for yourself.
1. Check "Test Script Action"
This column describes what Selenium will do when it receives a command. Look up your test tool's documentation to check how to do that action.
2. Verify on Sauce Labs
Run a test containing that action, then open the test's page on Sauce Labs. On the "Commands" tab, you'll see a list of all the actions your test took:
On the left you can see the Verb used; Next to that, the Command. On the right hand side, the image icon indicates whether or not a screenshot was taken. If the icon is present, there is a screenshot.
In the image above, the 'GET enabled' command (telling Selenium to see if a particular element is enabled) has no screenshot. The 'POST element/8d9add87-aee2-4f1f-a821-39de7bd19ff3/click' command does have a screenshot.
When finding a Command in the table above, you can ignore everything before the last slash. For instance, in the image above, you can ignore 'element/8d9add87-aee2-4f1f-a821-39de7bd19ff3', leaving 'click'. 'click' is listed in the table above, and you can see it has a screenshot.