I am trying to use puppeteer to select and click an option in a dropdown menu in a navbar.
I already searched. There is always a page.select with the ID of the dropdown menu, but the thing is, there is no value option.
How can i, for example, make puppeteer click on the Tools2 dropdown item?
Or, in a case of a dropdown menu with options that changes if you are a different user, how can i make puppeteer always click on the second option of a dropdown? Can i use CSS to make this work?
Here is the dropdown menu:
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="home.html">Home<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Tools
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="#">Tools1</a>
<a class="dropdown-item" href="#">Tools2</a>
<a class="dropdown-item" href="#">Tools3</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
User
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a href="#" class="dropdown-item" data-toggle="modal" data-target="#myModal">Create users</a>
<a method="get" class="dropdown-item" href="/usuario">Manage users</a>
<a class="dropdown-item" href="#">Profile</a>
<a method="get" action="/usuario/logout" class="dropdown-item" href="/">Logout</a>
</div>
</li>
</ul>