Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
guerrila
Posts : 1
Join date : 2011-07-06

How to get the value of an input with Web Driver? Empty How to get the value of an input with Web Driver?

Wed Jul 06, 2011 11:15 pm
Hello,

I'm new to Selenium 2 and I've read through the intro stuff and the tutorials, and I have my Selenium tests up and running nicely so far. However, I do have one basic question that I think I may have missed in the documentaiton, or perhaps it's harder to find than I thought...I need to verify the actual text value of an input rendered on screen ... I'm able to get the correct WebElement with an ID:

WebElement passwordInput2 = driver.findElement(By.name("password"));

however passwordInput2.getText() returns just an empty string (actually all webElements.getText() returns an empty string). Is there a better way to get to the text value of an input? I see lots of stuff on how to do this with Selenium IDE ... is Selenium IDE simply more powerful than the Selenium 2/WebDriver approach with Java?

Thanks so much in advance,
Pedro
avatar
ashish_techie
Amateur
Amateur
Posts : 73
Join date : 2011-08-09

How to get the value of an input with Web Driver? Empty Re: How to get the value of an input with Web Driver?

Fri Nov 04, 2011 9:28 pm
try getAttribute("value")

-Ashish
For selenium training and videos over 55 hours duration visit
http://qtpselenium.com/samplevideos/selenium/seleniumvideos.php
Back to top
Permissions in this forum:
You cannot reply to topics in this forum