Selenium WebDriver for retrieving HTML input value

0 votes

Following code is the HTML of a page. 

<input type="text" name="prettyTime" id="prettyTime" class="ui-state-disabled prettyTime"  readonly="readonly">

The display on the page is simply a string displaying time.
In WebDriver, there is a WebElement object referring to <input> tag using

WebElement timeStamp = waitForElement("prettyTime"));

I want the value of the element (what ever is displayed on the page). I tried every WebElement getters and nothing is useful for retrieving the value that the user sees. Any help? Thanks.

May 23, 2018 in Selenium by abc_xyz

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes



The text property is for text within the tags of an element. For input elements, the displayed text is not wrapped by the <input> tag, instead it's inside the value attribute.

answered May 23, 2018 by sniffy_god
• 760 points

Related Questions In Selenium

0 votes
1 answer

Selecting a dropdown value in Selenium WebDriver

Try to wrap your WebElement as shown ...READ MORE

answered Apr 9, 2018 in Selenium by QueenBee
• 1,810 points
0 votes
1 answer

Locating an element by value using css selector using Selenium WebDriver

Below code will help By.cssSelector("td[class='someclass'][value='u ...READ MORE

answered Apr 9, 2018 in Selenium by coldcode
• 1,980 points
0 votes
1 answer

Using gettext() method for the specific element using Selenium WebDriver

Mistake is that u r printing the ...READ MORE

answered Apr 10, 2018 in Selenium by Vardy
• 2,280 points
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,030 points
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
0 votes
1 answer
0 votes
2 answers

Is it possible to scroll down in a webpage using selenium webdriver programmed on python?

I using next code for facebook for ...READ MORE

answered 4 days ago in Selenium by

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.