A test fails on the build server about once in ten runs. On your machine it passes every time. Someone runs the build again, it passes, and the team moves on. Two weeks later the same test blocks a release.
Do not move on. Selenium records nothing about a run by itself: no screenshots, no video, no logs. So your first job is to make every failure leave evidence behind.
Where this code runs. The examples below go in your own Selenium project, in Node, with Mocha as the test runner. They read and write files, so they cannot run in the editor on this site.