selenium webdriver - ElementNotVisibleException: Element is not currently visible and so may not be interacted with -
i getting elementnotvisibileexception
page has no duplicate names name of "history" have "calls history". can suggest best locator locate element?
<li class="ui-widget ui-menuitem ui-corner-all ui-menu-parent" aria- haspopup="true" role="menuitem"> <a class="ui-menuitem-link ui-corner-all" href="javascript:void(0)"> <span class="ui-menuitem-text">history</span> <span class="ui-icon ui-icon-triangle-1-e"></span> </a>
the error
org.openqa.selenium.elementnotvisibleexception: element not visible , may not interacted (warning: server did not provide stacktrace information)command duration or timeout: 122 millisecondsbuild info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:03:33'system info: host: 'rsn-ga-78lmt-s2', ip: '127.0.1.1', os.name: 'linux', os.arch: 'amd64', os.version: '3.13.0-54-generic', java.version: '1.7.0_101'session id: 17716ecc-ffe3-40f9-92a6-8a106acf478ddriver info: org.openqa.selenium.firefox.firefoxdriver capabilities [{platform=linux, acceptsslcerts=true,javascriptenabled=true, cssselectorsenabled=true, databaseenabled=true, browsername=firefox, handlesalerts=true, nativeevents=false, webstorageenabled=true, rotatable=false, locationcontextenabled=true, pplicationcacheenabled=true, takesscreenshot=true, version=38.0.1}] atun.reflect.nativeconstructoraccessorimpl.newinstance0(native method)
if want a
element having text history
, try using linktext
expectedconditions.visibilityofelementlocated
wait until element visible below :-
webdriverwait wait = new webdriverwait(driver, 10); webelement linkelement= wait.until(expectedconditions.visibilityofelementlocated(by.linktext("history")));
or if want span
element having text history
, try using xpath
below :-
webdriverwait wait = new webdriverwait(driver, 10); webelement spanelement = wait.until(expectedconditions.visibilityofelementlocated(by.xpath("//span[text() = 'history']")));
edited :- if element
getting visible mouse on event try using action
perform mouseover
below :-
webdriverwait wait = new webdriverwait(driver, 10); webelement spanelement = wait.until(expectedconditions.presenceofelementlocated(by.xpath("//span[text() = 'history']"))); actions builder = new actions(driver); builder.movetoelement(spanelement).perform();
or
builder.mouse.mousemove(((locatable)spanelement).coordinates)
hope work..:)
Comments
Post a Comment