Login using phantomjs

Hello,

I’m trying to login Grafana dashboard using phantomjs to snapshot and save the image on the server.
But I’m having trouble to submit the login data… because there’s no available submit tag id…

part of js script that I worte is like this :

document.getElementByName(“username”).value=“user”;
document.getElementByName(“password”).value=“password”;
document.getElementByName(“loginclickbutton”).click();

It seems that i have to getElementByName the loginclickbutton… but it doesn’t show the name nor the id of the button on its html source…
So how could I write a js script that submits the login data?

Thanks

Would this work to get the login button:

document.querySelector('button[type=submit]')