'Please help me to focus input field in the instagram web [closed]

I want to achieve following algorithm:

Preconditions:

  1. You are logged in instagram web version
  2. You see the default home page
  3. You are using chrome
  4. It should be done via console tab in chrome

Task:

  1. Do in vanilla JS the focus of the input field with a recommendation window enter image description here i.e
  2. Focus the field, input cats, submit it and see the recommendation window

let search = document.querySelectorAll('[placeholder="Поиск"]')[0];
search.focus();
search.click();

Expected behaviour:

  1. Search input found
  2. Search input focused
  3. Recommendation popup appeared

Actual behaviour:

  1. Search input found
  2. Search input not focused

Thank you for any assistance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source