html - How to open a WebElement from a Hoover Menu Selenium JAVA -


hello i'm new using selenium , trying execute tests web page.

this code:

 system.setproperty("webdriver.gecko.driver","c:\\drivers\\geckodriver.exe");     webdriver driver = new firefoxdriver();     //open portal fiscal     driver.get("http://150.23.110.111/retenciones/");     //find field , enter user , password     driver.findelement(by.id("frmlogin:txtusr")).sendkeys("arrubio");     driver.findelement(by.id("frmlogin:txtpwd")).sendkeys("gnp00gnp");     driver.findelement(by.id("frmlogin:butlogin")).click();     actions action = new actions(driver);     webelement = driver.findelement(by.xpath(""));     action.movetoelement(we).movetoelement(driver.findelement(by.xpath(""))); 

i can enter page without problem , can enter user , password login, there's hoover menu on next page can´t use , stops automatic execution.

this xpath , csspath:

xpath: /html/body/div[3]/div/div/form/div/ul/li[1]/ul/li[1]/a/span

csspath: html body div#content div#leftpanel.ui-layout-unit.ui-widget.ui-widget-content.ui-corner-all.ui-layout-west.blankbck div.ui-layout-unit-content.ui-widget-content form#j_id1833690111_27e067e8.blankbck div#j_id1833690111_27e067e8:j_id1833690111_27e0678e.ui-menu.ui-menubar.ui-widget.ui-widget-content.ui-corner-all.ui-helper-clearfix ul.ui-menu-list.ui-helper-reset li.ui-widget.ui-menuitem.ui-corner-all.ui-menu-parent.ui-menuitem-active ul.ui-widget-content.ui-menu-list.ui-corner-all.ui-helper-clearfix.ui-menu-child.ui-shadow li.ui-menuitem.ui-widget.ui-corner-all a.ui-menuitem-link.ui-corner-all span.ui-menuitem-text

and element appears inspecting "búsqueda" button.

<ul class="ui-widget-content ui-menu-list ui-corner-all ui-helper-clearfix ui-menu-child ui-shadow" role="menu" style="display: block; height: auto; z-index: 1013; left: 0px; top: 28px;">  <li class="ui-menuitem ui-widget ui-corner-all" role="menuitem">  <a class="ui-menuitem-link ui-corner-all" href="/retenciones/main/faces/m_evapuntual.xhtml" style="width:120px" tabindex="-1">  <span class="ui-menuitem-text">búsqueda</span>  </a>  </li>  <li class="ui-menuitem ui-widget ui-corner-all" role="menuitem">  </ul>

how can select , open button "búsqueda" hoover menu?

thanks attention :)

try using:

actions action = new actions(driver); webelement menu = driver.findelement(by.xpath("xpath menu")); webelement item = driver.findelement(by.cssselector("css selector values búsqueda")); action.movetoelement(menu).movetoelement(item ).click().build().perform(); 

Comments