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

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

on Wed Jul 06, 2011 11:15 pm

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("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,
Posts : 73
Join date : 2011-08-09

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

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

For selenium training and videos over 55 hours duration visit
Back to top
Permissions in this forum:
You cannot reply to topics in this forum