Reputation: 129
I have the following code of HTML:
<div class="uk-form-row">
<textarea ng-model="attribute.description[0].text"
cols="30" rows="3" placeholder="Description" class="uk-form-width-medium ng-
pristine ng-valid ng-touched chromeXpathFinder chromeXpathFinder0">
</textarea>
</div>
I tried to create the following xpath but it doesn't work:
driver.findElement(By.xpath("//div[@class='uk-form-row']//textarea[@placeholder='Description']")).sendKeys("Hello description");
Could you please guide me on the right solution?
The exception it throws is :
Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: element not visible
Upvotes: 0
Views: 1856
Reputation: 4739
Try this xpath
//textarea[@placeholder='Description'][@class='uk-form-width-medium ng-
pristine ng-valid ng-touched chromeXpathFinder chromeXpathFinder0']
Try this too
//textarea[@placeholder='Description']
Upvotes: 0
Reputation: 7708
Use some wait until your element get visible and then send the text
Use ExplicitWait
like below
WebElement description = driver.findElement(By.xpath("//div[@class='uk-form-row']//textarea[@placeholder='Description']"));
WebDriverWait wait = new WebDriverWait(driver,60);
wait.until(ExpectedConditions.visibilityOf(description));
description.sendKeys("Text");
Upvotes: 1