Selenium (informatique)
Selenium
Dernière version |
4.16.0 ()[1] 4.18.0 ()[2] |
---|---|
Dépôt | github.com/SeleniumHQ et github.com/SeleniumHQ/selenium |
Assurance qualité | Intégration continue |
État du projet | Actif |
Écrit en | Java |
Système d'exploitation | Microsoft Windows |
Environnement | multiplateforme |
Type |
Test environment (d) Framework Test automation framework (en) Bibliothèque logicielle |
Licence | Licence Apache version 2.0 |
Site web | selenium.dev et www.selenium.dev |
Selenium est un framework de test informatique développé en Java.
Il est associé à
- Selenium IDE, extension Firefox, pour l'utiliser.
- Selenium Remote Control (RC) qui permet d'écrire des tests d'automation dans certains langages de programmation (PHP, Python, Ruby, .NET, Perl et Java)
Exemples de tests avec Selenium
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class CategoryModifTest extends PHPUnit_Extensions_SeleniumTestCase
{
protected function setUp()
{
$this->setBrowser("*firefox");
$this->setBrowserUrl("http://…");
}
public function testCategoryModif()
{
$this->open("http://...");
$this->type("modlgn_username", "admin");
$this->type("modlgn_passwd", "password");
$this->click("link=Connexion");
$this->waitForPageToLoad("30000");
$this->open("http:.../administrator/index.php?...");
$this->waitForPageToLoad("30000");
$name = $this->getTable("//div[@id='element-box']/div[2]/form/table.2.2");
$this->click("link=".$name);
$this->waitForPageToLoad("30000");
$this->type("name", "Ordinateurs portables modifié");
$this->click("//td[@id='toolbar-save']/a/span");
$this->waitForPageToLoad("30000");
try {
$this->assertTrue($this->isTextPresent("Ordinateurs portables modifié"));
} catch (PHPUnit_Framework_AssertionFailedError $e) {
array_push($this->verificationErrors, $e->toString());
}
$this->click("link=Ordinateurs portables modifié");
$this->waitForPageToLoad("30000");
$this->type("name", "Ordinateurs portables");
$this->click("//td[@id='toolbar-save']/a/span");
$this->waitForPageToLoad("30000");
$this->click("link=Déconnexion");
$this->waitForPageToLoad("30000");
}
}
En PHP, Selenium s'interface avec PHPUnit[3].
Références
- « Release Selenium 4.16 »,
- « Release 4.18.0 », (consulté le )
- Chaine complète de test avec Selenium IDE, Selenium RC et PHPUnit
Lien externe
- (en) Site officiel