1

So I'm starting out with PHPUnit and Selenium 2

public function testHasALoginForm()
{
    $this->url('/login');

    $username = $this->byName('username');
    $password = $this->byName('password');

    $this->assertEquals('', $username->value());
    $this->assertEquals('', $password->value());
}

This only happens when I call the value() method from the element and I end up getting:

1) test\view\LoginTest::testHasALoginForm
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: GET /session/fdcf0669-1d42-4a35-8e7a-29dec4a0f1e4/element/0/value
Build info: version: '2.42.1', revision: '68b415a', time: '2014-05-29 16:16:49'
System info: host: 'Something.local', ip: '192.168.1.108', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.3', java.version: '1.8.0_05'
Driver info: driver.version: unknown

Am I doing something wrong?

2 Answers 2

5

The ->value() method has been removed in selenium v2.42.0. The currently recommended solution is to use $element->attribute('value')

@see https://code.google.com/p/selenium/source/detail?r=953007b48e83f90450f3e41b11ec31e2928f1605

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, this solved it for me. I found this very hard to diagnose - even stepping through the code and seeing a 500 error coming back from the server via curl didn't shed any light. So frustrating when old code stops working! thanks for the solution.
1

Hi i'm getting exactly the same error with roughly the same code. I am using the same version of selenium as you are. However I did not get this error when using the 2.39.0 version. Hence it seems to be either a regression or a deprecated use.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.