Need to automate stuff in browser like taking a screenshot of page or testing certain links. How can I achieve this? I have seen people mentioning selenium for it. What is the best way to go about it?
Well with automated browserless or emulated browser testing.
I use selenese runner to run selenium commands against a browser - usually phantomjs. Really depends on how complex you want to do. Scripting something like phantomjs directly would give you some more flexibility.
I was recently introduced to Cypress https://www.cypress.io. It's a testing tool that can, amongst other things, run browser automation. One of it's features is that it 'does not use Selenium.' :-)
Selenium is one way, but you should give phantomjs a go.