简体   繁体   中英

PHPUnit Selenium2 Error on getting current input text value

I'm having strange behavior while trying to get input text value:

$this->byXPath( "//input[contains(@id, '_rule_1_display_times')]" )->value();

Error output:

PHPUnit_Extensions_Selenium2TestCase_WebDriverException : GET /session/3ef42f7e-f5f5-459d-92e2-6377c6f05e61/element/4/value Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System info: host: 'vytautas', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-49-generic', java.version: '1.7.0_75' Driver info: driver.version: unknown

It's strange cause I can set value to this input without any problem:

$this->byXPath( "//input[contains(@id, '_rule_1_display_times')]" )->value(8);

Any ideas what's wrong with getting current input text value?

Value gives you the current value of the field vs attribute(value) that gives you the original value. It was asked here: Difference between Element.value and Element.getAttribute("value") So I'm guessing your current value is simply empty/not set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM