java - Facing issue while clicking dropdown button using selenium webdriver code -
the application using having several dropdown buttons having same xml code. below code similar dropdown buttons.
<button class="btn dropdown-toggle bs-placeholder btn-default" role="button" data-toggle="dropdown" type="button" data-id="invcontactlist" title="" data-original-title="nothing selected">
i have use below code click button
driver.findelement(by.xpath("//button[@data-toggle='dropdown']")).click();
using code application run once there after gives error as: org.openqa.selenium.elementnotvisibleexception: element not visible , may not interacted command. have removed browser cookies wont help.
can please me root cause , solution ?
you might need wait element :
webdriverwait wait = new webdriverwait(driver, 10); wait.until(expectedconditions.elementtobeclickable(by.xpath("//button[@data-toggle='dropdown']"))).click();
or
wait.until(expectedconditions.elementtobeclickable(by.xpath("//button[@data-id='invcontactlist']"))).click();
or
wait.until(expectedconditions.visibilityofelementlocated(by.xpath("//button[@data-toggle='dropdown']"))).click();
or
wait.until(expectedconditions.visibilityofelementlocated(by.xpath("//button[@data-id='invcontactlist']"))).click();
try @ end.
Comments
Post a Comment