Login in web console

Hello, I have a project in which I have to log in with javascript commands, and I can’t find the forms that is sent to log in.

Commands I use:

document.getElementsByName('username').value = 'username'
document.getElementsByName('password').value = 'password'

And I don’t find FORMNAME

Hoping that someone can help me,

Our end-to-end tests for InfluxDB 2 OSS log in via the UI, so you could reference this code to see what the correct element names are: ui/commands.ts at b5b0a48a6079dacf3ffd0cd175024f6044b7b2a9 · influxdata/ui · GitHub

The username element ID is actually login.

To submit the form, I think you could try:


Hello, I haven’t seen your reply. Thank you for your help, but your solution doesn’t work,
also, I’ve found a solution to get the form (document.getElementByTagName(“form”)[0]).
And in another project I’m working on, I found another solution to send form:

button is the ‘sign in’ button as an example.

But I might be cursed, it still doesn’t work.
When I change the value of my password and username fields, and the use ‘click()’, it tells me that I didn’t filled up the fields:

And I think I’ve found why it doesn’t work, it’s because these fields are not filled:

POST /api/v2/signin HTTP/1.1
Host: XXX.XXX.XXX.XXX:8086
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://XXX.XXX.XXX.XXX:8086/signin
authorization: Basic Og==                         <-----------------this one
Origin: http://XXX.XXX.XXX.XXX:8086
Connection: keep-alive
Cookie:                      <-----------------this one too
Content-Length: 0

The question is: how can I fill it, is it even possible with javascript?