I\'m able to verify whether or not an element exists and whether or not it is displayed, but can\'t seem to find a way to see whether it is \'clickable\' (Not talking about
You can wait for the element to be clickable:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
driver.get("http://somedomain")
element = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.ID, "myDynamicElement"))
)
Or, you can follow the EAFP principle and catch an exception being raised by click()
:
from selenium.common.exceptions import WebDriverException
try:
element.click()
except WebDriverException:
print "Element is not clickable"
to click an (for selenium) unreachable element i alwas use:
public void clickElement(WebElement el) throws InterruptedException {
((JavascriptExecutor) driver).executeScript("arguments[0].click();", el);
}
You can use webElement.isEnabled()
and webElement.isDisplayed()
methods before performing any operation on the input field...
I hope this will solve you problem...
Else, you can also put a loop to check above 2 conditions and if those are true you can specify the input text and again you can find the same element and you can get the text of the webelement and compare that text with the text you entered. If those matches you can come out of the loop.