I need to click on an element inside a Dropdown container. I've tried several searchs but I haven't been able to find the correct solution. The select method doesn't work, and I still don't know how to work with Selectors when there's no ID, Name or Class related to it. Here's the HTML code:
<a href="/account/settings/info"class="account-link">Account<span class="caret"></span></a>
<div class="account-dropdown__container">
<ul>
<li><a href="/account/settings/info" target="_self">Account</a></li>
<li><a href="/wedding-registry/invite" target="_self">Invite Friends</a></li>
<li><a href="/account/settings/credits" target="_self">Zola Store Credit</a></li>
<li><a href="/registry/settings/info" target="_self">Registry Settings</a></li>
<li><a href="/account/settings/orders" target="_self">Orders You've Placed</a></li>
<li><a>Log out</a></li>
</ul>
</div>
The first piece of code is a button, but if I put my mouse over it, it will show the Dropdown container that I am talking about. If I put my mouse over it without clicking, it will show the list of the Dropdown Container. (And I would also like to know how to hover an element to show the list without clicking it, because its hidden).
My question is, then: how can I click on Registry Settings?
It doesn't have an ID, nor a class (although it is inside the class account-dropdown__container
). I think I can use By.name("Registry Settings")
, but since is not visible unless the Dropdown list is open, it won't click and it will show Css Selector not found
error. Care to help? Thanks!
Also, I am using Cucumber + Selenium + Java in IntelliJ IDEA, the synthaxis changes just a bit, but it is still different from the codes I tend to find in this forum. Hence, why I am asking for a specific solution to my problem.