0

I'm using Selenium + Java bindings and I want to know if anyone has an idea how to extract a value from a text field. I tried the following code, but without success:

String value = selenium.getValue(lss.get(i))
logger.info("ma val :" + selenium.getValue(remplace));
Petr Janeček
  • 37,768
  • 12
  • 121
  • 145
asmae
  • 31
  • 1
  • 1
  • 6
  • This is the right way to do it. Are you absolutely sure you are giving the right locators to the function? Make sure by using [`highlight()`](http://selenium.googlecode.com/svn/trunk/docs/api/java/com/thoughtworks/selenium/Selenium.html#highlight%28java.lang.String%29) on it, too. – Petr Janeček Jul 17 '12 at 09:46
  • yes , you are right the locator wasn't the right one , thank you – asmae Jul 17 '12 at 11:06
  • :), please post an answer (and accept it) or even delete the question then, we like our Stack Overflow nice and clean. – Petr Janeček Jul 17 '12 at 11:12
  • this is the answer : val=selenium.getValue("//span[text()=\""+remplace+" \"]/following-sibling::input"); logger.info("ma val :"+selenium.getValue("//span[text()=\""+remplace+" \"]/following-sibling::input")); – asmae Jul 17 '12 at 12:18
  • 1
    yes i know but i don't have the right to answer my own question because i'm with less than 10 reputations so i need to wait for 8 hours after asking ... – asmae Jul 17 '12 at 12:28

1 Answers1

0

The OP given answer is as follows:

val=selenium.getValue("//span[text()=\""+remplace+" \"]/following-sibling::input");
logger.info("ma val :"+selenium.getValue("//span[text()=\""+remplace+" \"]/following-sibling::input")); 
demongolem
  • 9,474
  • 36
  • 90
  • 105