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.

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
• 780 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,820 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=' ...READ MORE

answered Apr 9, 2018 in Selenium by coldcode
• 2,050 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,370 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,510 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,870 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,870 points
0 votes
2 answers

When executing my Jenkins tests with Selenium WebDriver, I do not see a GUI.

Hi eLiJha, I also faced the same issue ...READ MORE

answered Jul 15, 2019 in Selenium by nayan
• 160 points
+1 vote
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 May 16, 2019 in Selenium by