Here is javascript code.
document.querySelectorAll("li[class='user selected']")
I wanna click on this element but this code does not work
document.querySelectorAll("li[class='user selected']").click();
How can I click on this element ? Thanks.
Edit : this is Html code
<ul class="search" id="typeahead_list_u_0_2" role="listbox">
<li class="user selected" title="Special Username" aria-label="Special Username" role="option" aria-selected="true" id="js_g">
<a href="https://..." rel="ignore" target=""><img alt="" src="https://...">
<span class="text">Special Username</span>
</a>
</li>
</ul>
querySelectorAllwill return you array of selected element. Not the first match. UsequerySelectorinsteadlielement with classuser selected? Or manylielements will have that class ?