Access to the code pages in Selenium

There is an interface test with Selenium/phpUnit.

You need to write a test authorization in the control panel.
The problem is that when you log into the admin sets additional issue for which a known answer. Something like a list of the pin on the card, only pincode is known in advance.

class newSeleneseTest extends PHPUnit_Extensions_SeleniumTestCase {<br> function setUp() {<br> $this->setBrowser("*iexplore");<br> $this->setBrowserUrl(""); <br> }<br> testAdminAccess function() {<br> $this->open("/admin/");<br> $this->type("id=user", "admin");<br> $this->click("name=login");<br> $this->waitForPageToLoad("3000");<br> $this->type("id=pass", "123456");<br> $this->type("id=add_question", "111222333");//here is one of the dictionary values.<br> } <br> }

Is it possible to do a search for page content and, depending on the location of a question in the body of the page to enter in input a certain answer?
October 8th 19 at 03:27
2 answers
October 8th 19 at 03:29
Go to WebDriver :)


For SeRC

And so you can write js to pull the text.

Don't look at what the documentation for Java, the same methods should be and to php.
October 8th 19 at 03:31
In SeleniumRC is a method getBodyText
In WebDriver getPageSource

In java this code would look like this:

Find more questions by tags SeleniumPHPUnit