Answer the question
In order to leave comments, you need to log in
Accessing page code in Selenium
There is an interface test on Selenium/phpUnit.
It is necessary to write an authorization test in the control panel.
The problem is that when you enter the admin panel, an additional question is asked, to which the answer is known in advance. Something like a list of pincodes on a card, only the pincodes are known in advance.
Is it possible to do a search on the content of the page and, depending on the location of a particular question in the body of the page, enter a specific answer into the input?
class newSeleneseTest extends PHPUnit_Extensions_SeleniumTestCase {
function setUp() {
$this->setBrowser("*iexplore");
$this->setBrowserUrl("http://www.somesite.ru/");
}
function testAdminAccess() {
$this->open("/admin/");
$this->type("id=user", "admin");
$this->click("name=login");
$this->waitForPageToLoad("3000");
$this->type("id=pass", "123456");
$this->type("id=add_question", "111222333");//здесь находится одно из указанных значений словаря
}
}
Answer the question
In order to leave comments, you need to log in
Switch to WebDriver :)
getPageSource ,
For SeRC
And so you can write js that will pull out the given text.
getEval
Do not look at the documentation for Java, similar methods should be for php.
In SeleniumRC there is a getBodyText method
In WebDriver getPageSource
In java, a similar code would look like this:
if(driver.getPageSource().contains("ololol")){
doSomething();
}else{
doSomethingElse();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question