Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if an element is clickable or not using Selenium WebDriver

I have a container, which contains number of elements.I am looping thru the elements. My question is what is the syntax for checking if the element is NOT clickable.

like image 280
tickmoh Avatar asked Jun 14 '15 06:06

tickmoh


2 Answers

Following should make it work -

element.is_displayed() and element.is_enabled()

This code is in Python. You can change it to the language of your choice.

like image 198
Vikas Ojha Avatar answered Sep 21 '22 08:09

Vikas Ojha


The existing methods, isDisplayed and isEnabled cannot check for whether the element is clickable or not.

If you want to wait for element till it is clickable and then click it, you may like to look this: Selenium WebDriver - determine if element is clickable (i.e. not obscured by dojo modal lightbox)

Actually, it may be difficult to check whether the element is clickable or not without actually clicking it.

like image 27
Manu Avatar answered Sep 22 '22 08:09

Manu