FAQ
i need to extract the text present in the input field...the text displays
only after the above fields are entered..

String name=driver.findElement(By.xpath("//*[@id='vo_name']")).getText();
System.out.println(name);

but the text was not displaying?

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/eiRcjyzwfVkJ.
To post to this group, send email to webdriver@googlegroups.com.
To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Search Discussions

  • Ram Maram at Nov 12, 2012 at 1:41 pm
    getText() wont works for getting value from textfield, can use getValue()


    you can use like

    String valText=new
    WebDriverBackedSelenium(driver,driver.getCurrentURL()).getValue("xpath=//*[@id='vo_name']");



    Thanks,
    Ram
    On Mon, Nov 12, 2012 at 4:49 AM, divya angel wrote:

    i need to extract the text present in the input field...the text displays
    only after the above fields are entered..

    String name=driver.findElement(By.xpath("//*[@id='vo_name']")).getText();
    System.out.println(name);

    but the text was not displaying?

    --
    You received this message because you are subscribed to the Google Groups
    "webdriver" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/webdriver/-/eiRcjyzwfVkJ.
    To post to this group, send email to webdriver@googlegroups.com.
    To unsubscribe from this group, send email to
    webdriver+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/webdriver?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "webdriver" group.
    To post to this group, send email to webdriver@googlegroups.com.
    To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
  • Divya angel at Nov 12, 2012 at 6:11 pm
    Thanx sriRAm,....your code worked well ..but darrell has given a nice
    answer because instead of using RC we can use the webdriver getattribute()
    method ri8..

    thanx. TC
    On Monday, November 12, 2012 7:11:40 PM UTC+5:30, SriRam wrote:

    getText() wont works for getting value from textfield, can use getValue()


    you can use like

    String valText=new
    WebDriverBackedSelenium(driver,driver.getCurrentURL()).getValue("xpath=//*[@id='vo_name']");



    Thanks,
    Ram

    On Mon, Nov 12, 2012 at 4:49 AM, divya angel <divya....@gmail.com<javascript:>
    wrote:
    i need to extract the text present in the input field...the text displays
    only after the above fields are entered..

    String name=driver.findElement(By.xpath("//*[@id='vo_name']")).getText();
    System.out.println(name);

    but the text was not displaying?

    --
    You received this message because you are subscribed to the Google Groups
    "webdriver" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/webdriver/-/eiRcjyzwfVkJ.
    To post to this group, send email to webd...@googlegroups.com<javascript:>
    .
    To unsubscribe from this group, send email to
    webdriver+...@googlegroups.com <javascript:>.
    For more options, visit this group at
    http://groups.google.com/group/webdriver?hl=en.

    --
    You received this message because you are subscribed to the Google Groups "webdriver" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/gu1tYLQTvFgJ.
    To post to this group, send email to webdriver@googlegroups.com.
    To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
  • Darrell at Nov 12, 2012 at 1:49 pm
    As pointed out, the getText() method gets the CDATA between the open and
    close tag. For example, given <b>text</b> the getText() would get the
    "text" string. If you look at the the input tag you should see something
    like: <input id="foo" value="text"/>. There is no CDATA and therefore the
    getText() will return nothing.

    Personally, I choice to use WebDriver and not fall back on Selenium. The
    getAttribute() method can be used to get the value of an input tag, e.g.

    WebElement we = driver.findElement(By.id("foo"));
    String value = we.getAttribute("value");

    This works for the example input tag I provided. Obviously, you'd replace
    the first line with the line which finds your input element.

    Darrell
    On Monday, 12 November 2012 07:49:22 UTC-5, divya angel wrote:

    i need to extract the text present in the input field...the text displays
    only after the above fields are entered..

    String name=driver.findElement(By.xpath("//*[@id='vo_name']")).getText();
    System.out.println(name);

    but the text was not displaying?
    --
    You received this message because you are subscribed to the Google Groups "webdriver" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/Xb8g2HL8hQgJ.
    To post to this group, send email to webdriver@googlegroups.com.
    To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
  • Divya angel at Nov 12, 2012 at 6:14 pm

    Thanx darrell,
    worked well.. based on ur code i modified it and write it like this

    String
    name=driver.findElement(By.xpath("//*[@id='vo_name']")).getAttribute("value");
    System.out.println(name);

    and it worked....i was new to webdriver...so it is taking quite a long time
    for learning it through net and posting my doubts in the groups..and i hope
    to get the support of people like u..
    thanQ

    --
    You received this message because you are subscribed to the Google Groups "webdriver" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/Fo9KB9VKRZYJ.
    To post to this group, send email to webdriver@googlegroups.com.
    To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
  • Dibyaranjan Kar at Nov 13, 2012 at 7:23 am
    Hello Divya,

    if your driver.findElement returns a single element and there is ID
    attribute which is unique and static for the page, then why do you need to
    use xpath. you can also use

    driver.findElement(By.id("YOUR ID")).getAttribute("value"); //It will be
    faster as compared to xpath

    Thanks
    Dibya
    On Monday, 12 November 2012 23:44:49 UTC+5:30, divya angel wrote:

    Thanx darrell,
    worked well.. based on ur code i modified it and write it like this

    String
    name=driver.findElement(By.xpath("//*[@id='vo_name']")).getAttribute("value");
    System.out.println(name);

    and it worked....i was new to webdriver...so it is taking quite a long
    time for learning it through net and posting my doubts in the groups..and i
    hope to get the support of people like u..
    thanQ
    --
    You received this message because you are subscribed to the Google Groups "webdriver" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/NQTT9M1CJLEJ.
    To post to this group, send email to webdriver@googlegroups.com.
    To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
  • Divya angel at Nov 13, 2012 at 7:29 am
    Hi Dibyaranjan Kar ,

    thanx for ur reply, yeah ,,i have used ID property also...

    happy diwali

    --
    You received this message because you are subscribed to the Google Groups "webdriver" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/SblB0HYrXOQJ.
    To post to this group, send email to webdriver@googlegroups.com.
    To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
  • Dibyaranjan Kar at Nov 13, 2012 at 4:51 pm
    Happy Diwali to you and all :)
    On Tuesday, 13 November 2012 12:59:37 UTC+5:30, divya angel wrote:

    Hi Dibyaranjan Kar ,

    thanx for ur reply, yeah ,,i have used ID property also...

    happy diwali
    --
    You received this message because you are subscribed to the Google Groups "webdriver" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/CuKXcAHQAcEJ.
    To post to this group, send email to webdriver@googlegroups.com.
    To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupwebdriver @
categorieswatir
postedNov 12, '12 at 12:49p
activeNov 13, '12 at 4:51p
posts8
users4
websitewatir.com

People

Translate

site design / logo © 2021 Grokbase