I found 2 errors.
1. There is no function named getElementByClassName
its getElementsByClassName
(with an s)
2. document.getElementsByClassName
returns a collection of HTMLElement you need the first one so you might have to use an array index notation.
Finally,
It should look like,
var test = document.getElementsByClassName("PortSwap active")[0]