2

1) I have entered name in "Full Name" text box field.

 WebElement name = driver.findElement(By.id("userId"));
        name.sendKeys("Sekhar");

it has entered value in the textbox.

2) I have to validate that "Sekhar" is presented in the textbox. but here the problem is the value entered in the textbox is displaying in watermark logger.info(name.getText()); does not returning a value

because it is displayed in watermark in the textbox.

please help me how to get a watermark text in textbox.

0

2 Answers 2

7

It would depend on what do you mean by watermark and what is the HTML representation of the input element. But, this should be either a value attribute:

name.getAttribute('value');

or could be a placeholder:

name.getAttribute('placeholder');
Sign up to request clarification or add additional context in comments.

Comments

-3
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("document.getElementById('xxxx').style.display='block';");

3 Comments

what its this response about??
Welcome to stack overflow :-) Please look at How to Answer. You should provide some information why your code solves the problem. Code-only answers aren't useful for the community.
Some explanation makes the difference between a good and a perfect answer. Please edit your answer and add some context.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.