Sometimes, nothing short of the real thing will work. Selenium is a project to achieve automation in web browsers. It's conceived as a way of automatic testing, but it also can be used to automate interactions with a site.
Selenium can control Safari, Chrome, Firefox, Internet Explorer, or Microsoft Edge, though it requires installing a specific driver for each case. We'll use Chrome.