Hi
I have started automation using Leap test tool . But I am getting error web element was found but not clickable .
Please help me to resolve this issue
Can you provide more information? Screen shot perhaps?
Hello Satveer. Leaptest Support can definitely help you. They are available via the pop-up chat on Leaptest.com
Best regards,
Aske, Leaptest
@Aske Yeah I have tried it looks good for automation but It is not always executable It gives me error web elelment was found but not clickable โฆ
When you are looking at a web page there are three dimensions. You have left/right and up/down but there is a third dimension called z-order. For example,
<div class='foo'><span class='bar' onclick='javascript goes here'><a href="some http link">Click Me</a></span></div>
When you look at this on the screen you just see the โClick Meโ text but it is actually three layers deep.
When you get the message that a web element was found but it was not clickable, WebDriver is saying that the element you are trying to click is underneath another element. In my example, the SPAN has an onclick attribute. If you try to click the anchor (the A element), the click will get captured by the SPAN and the anchor might be unclickable. So driver.findElement(By.text(โClcik Meโ)).click() might fail with the not clickable message.
An even more common reason is a guard or a modal. For example, a guard is used when a developed doesnโt want you to double click something or click something before their javascript is ready. I might code something such that when you click a link, I set the to be opaque. This means everything on the page is unclickable. I then initialize some javascript and finally I make the transparent (everything is clickable again).
With a human what happens is:
- Click something
- BODY goes opaque
- Javascript initializes in 250 ms
- BODY goes transparent
- human clicks the next element
Steps 2 to 4 happen so quickly, you might not even see it. But WebDriver is a LOT faster than a human. So what happens with WebDriver is:
- Click something
- BODY goes opaque
- WebDriver tries to click the next element
- web element was found but not clickable
- Javascript initializes
- BODY goes transparent
A bad way to solve this is just add a sleep statement. For example:
- Click something
- sleep for 5 seconds
- BODY goes opaque
- Javascript initializes in 250 ms
- BODY goes transparent
- sleep expires
- WebDriver clicks the next element
In WebDriver code this would be:
- Click something
- sleep 5 seconds
- WebDriver clicks the next element
If you try this and it works, you can make it better by using WebDriverWait. For example,
- Click something
- WebDriverWait wdw = new WebDriverWait(driver, 5);
- WebElement nextElement = driver.findElement(the next element)
- wdw.until(ExpectedConditions.clickable(nextElement));
- WebDriver clicks the next element
There are subtle difference depending on exactly what is happening in your case. Posting an example might help.
Darrell
Hi Satveer, Please check following article "I am getting error โWeb element was found but not clickableโ in Leaptest knowledge base to get resolution of your issue.
Best regards,
Praveen, Leaptest
Thanks @Parveen . Great! It is very useful for me .