Does it make sense to check Text () on an element that just executed type () on it?

I am wondering if the following functional test is possible. I am working with PHPUnit_Extensions_SeleniumTestCase with Selenium-RC here, but the principle (I think) should apply everywhere.

Suppose I execute the following command for a specific div:

function testInput() {
    $locator = $this->get_magic_locator(); // for the sake of abstraction
    $this->type( $locator, "Beatles" ); // Selenium API call
    $this->verifyText( $locator, "Beatles" ); // Selenium API call
}

Conceptually, I believe this test should work. I enter data in a specific field and I just want to check that the text now exists as entered.

However, the results of my test (the assertion verifyTextfails) show that the content of the element is $locatorempty even after input.

There was 1 failure:

1) test::testInput
Failed asserting that <string:> matches PCRE pattern "/Beatles/".`

Has anyone else tried something like this? Should this work? Am I making a simple mistake?

+3
source share
2

verifyValue(locator,texttoverify), verifyText(locator,value)

+2

( " ..." ), , . , , - , . JavaScript, , .

- " ".

+1

All Articles