can't use javascript on site

138 views
Skip to first unread message

Kálmán Őrsi

unread,
May 9, 2023, 5:50:58 AM5/9/23
to Autofill Extension
Hello!

I want to autofill and submit search form on this site:
Bust javascript code doesn"t work:

let searchbox = document.querySelector('#searchDesktop');
if (searchbox) {
  searchbox.focus();
  searchbox.value = 'search_key';
  searchbox.submit();
}

With selecting TYPE: Text, the form can be filled.

Thank you.

Kálmán Őrsi

unread,
May 15, 2023, 5:07:04 AM5/15/23
to Autofill Extension
This is how I solved:

const forms = document.querySelectorAll(".form-control");
forms[1].value = "search_key";
const event = new Event('input', { bubbles: true });
forms[1].dispatchEvent(event); 

//submit 
const buttons = document.querySelectorAll(".searchBtn");
buttons[1].click();

Autofill Extension

unread,
May 18, 2023, 2:17:08 PM5/18/23
to Autofill Extension
I'm glad you solved your issue!
Reply all
Reply to author
Forward
0 new messages