Dhaval Atri Dhaval Atri - 4 years ago 120
Java Question

Unable to click on dropdown made by <div> using Selenium WebDriver

HTML code

<div qxselectable="off" >
<div qxselectable="off" >
<div tabindex="1" qxselectable="off" >
<div tabindex="1" qxselectable="off" >
<div style="overflow: hidden; >Discrepancy Type*</div>
<div class="qx-input-required" tabindex="7" ">
<input class="qx-abstract-field qx-placeholder-color" >
//On Below button there is one dropdown button on which i want to click but i cannot
<div class="qx-button" qxselectable="off" >
<div qxselectable="off" qxanonymous="true" ></div>
<div tabindex="1" qxselectable="off" >
<div class="qx-outSet" qxse..

Java Code

WebElement element = wd.findElement(By.className("qx-input-required"));
Actions actions = new Actions(wd);
wd.findElement(By.xpath(".//*[@id='demindoRoot']/div[3]/div[2]/div[1]/div/div[2]/div[2]/div/div")).click(); // link through which i try to click

I also tried with below mention code


enter image description here

Error :

Unable to locate element:

Answer Source

Basically when we works with anywebapplication which developed using any javascript freamwork at that w cannot get any proper element to interact. We have to work with lots of and . So while selecting any value from dropdown we have to use sendkeys. OR simple type single character and select value from suggestion list. Above two solution works for me .

Thanks -Dhaval

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download