How to locate the element:
<input type="text" placeholder="Enter Area / Locality" class="" value="">
I tried:
//input[@placeholder='Enter Area / Locality']
but it is not working.
I want to send keys at this placeholder from selenium code.
How to locate the element:
<input type="text" placeholder="Enter Area / Locality" class="" value="">
I tried:
//input[@placeholder='Enter Area / Locality']
but it is not working.
I want to send keys at this placeholder from selenium code.
I don't see any issue with your code trial. As an alternative you can use the following xpath based Locator Strategy:
//input[@placeholder=\"Enter Area / Locality\"]"
However, ideally as it is an <input>
element and you want to invoke click()
on it, you need to use elementToBeClickable()
and you can use either of the following Locator Strategies:
cssSelector
:
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input[placeholder='Enter Area / Locality']"))).click();
xpath
:
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@placeholder='Enter Area / Locality']"))).click();