I want to do the following:
- Go to a website
 - Click on a button => a javascript function will change parts of the html
 - Fetch some contents of the newly changed html
 
All these automatically
I tried several tools provided for nodejs including node-cralwer and PhantomJS
Currently, I have this code running in PhantomJS
page.open('https://www.thegioididong.com/dtdd/iphone-x-256gb', function (status) {
    console.log("Status: " + status);
    var a = page.evaluate(function () {
        document.getElementsByClassName("viewparameterfull")[0].click()
        console.log(document.getElementsByClassName('parameterfull')[0].textContent)
        return document.getElementsByClassName('parameterfull')[0].textContent
    })
    phantom.exit();
})
and the output was
Status: success
ReferenceError: Can't find variable: getFullSpec
Using Chrome Debugger, I can see that getFullSpec is a function that:
Is fired when the button selected in the code is clicked
Can be found on another
jsfile that is downloaded when the page loads.
My questions are:
When
PhantomJSopens a link withpage.open(), does it load every file (js, css...) like the browser does?If it does, how can I use
PhantomJSto run thatgetFullSpec(which is contained in anotherjsfile)?