I'm trying to access to the permissions section in the page i'm working for, for a test in selenium, but i don't know how to handle that element, i guess is a dropdown menu, so i make a code like this (I'm using selenium POM btw):
[FindsBy(How = How.CssSelector, Using =".dir")]
private IWebElement elemPermi;
public Permissions selectElementFromDropdown( string text)
{
SelectElement drop = new SelectElement(elemPermi);
drop.SelectByText(text);
return new Permissions(driver);
}
And in the test i have this:
UsuarioMain usuario = new UsuarioMain(driver);
usuario.selectElementFromDropdown("Modules");
This is the HTML code of the page:
<div id="mainmenu">
<ul id="nav" class="dropdown dropdown-horizontal">
<li class="normal"><a href="/TravelTendering/" class="selected">Home</a></li>
<li class="normal"><a href="/TravelTendering/Configuration">Configurations</a></li>
<li class="dir">Permissions<div class="separadorMenu"></div>
<ul class="dropdownMenu"><li><a href="/TravelTendering/Profile">Profiles</a></li>
<li><a href="/TravelTendering/Role">Roles</a></li>
<li><a href="/TravelTendering/Permission">Modules</a></li>
<li><a href="/TravelTendering/User">Users</a></li>
</ul>
</li>
<li class="dir">Tenders<div class="separadorMenu"></div>
<ul class="dropdownMenu"><li><a href="/TravelTendering/Tender">Create Tender</a></li>
<li><a href="/TravelTendering/SeeTender">See Tenders</a></li>
</ul>
</li>
<li class="normal"><a href="/TravelTendering/Supplier">Invitations</a></li>
<div style="clear:both; float:none;"></div>
</ul>
</div>
But when i run my test this error appears:
Message: OpenQA.Selenium.Support.UI.UnexpectedTagNameException : Element should have been select but was li
I want to be able to interact with any element of the dropdown, so if you guys can help me, i will appreciate it a lot.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…