Bonjour.
J’essaie de faire un audit de type Scenario et l’audit plante par une erreur Unable to locate element.
C’est un test assez basique:
- Accès à une URL
- Wait
- Saisie d’une valeur dans un champ Input
Le test est lancé depuis la console web d’Asqatasun
J’ai testé avec des locators de type id, css selector et Xpath
Les scripts json:
- Avec selector ID
{
"type": "script",
"seleniumVersion": "2",
"formatVersion": 2,
"steps": [
{
"type": "get",
"url": "Url site"
},
{
"type": "pause",
"step_name": "2",
"waitTime": "1000"
},
{
"type": "setElementText",
"locator": {
"type": "id",
"value": "login__form--username"
},
"text": "login"
}
],
"data": {
"configs": {},
"source": "none"
},
"inputs": [],
"timeoutSeconds": 10
}
- CSS Selector:
{
"type": "script",
"seleniumVersion": "2",
"formatVersion": 2,
"steps": [
{
"type": "get",
"url": "Url site"
},
{
"type": "pause",
"step_name": "2",
"waitTime": "1000"
},
{
"type": "setElementText",
"locator": {
"type": "css selector",
"value": "#login__form--username"
},
"text": "logn"
}
],
"data": {
"configs": {},
"source": "none"
},
"inputs": [],
"timeoutSeconds": 10
}
- puis XPATH
{
"type": "script",
"seleniumVersion": "2",
"formatVersion": 2,
"steps": [
{
"type": "get",
"url": "Url site"
},
{
"type": "pause",
"step_name": "2",
"waitTime": "10000"
},
{
"type": "setElementText",
"locator": {
"type": "xpath",
"value": "//input[@id='login__form--username']"
},
"text": "login"
}
],
"data": {
"configs": {},
"source": "none"
},
"inputs": [],
"timeoutSeconds": 10
}
La partie HTML de la page login:
<div id="login">
<div class="row vertical-center">
<div class="col-xs-12 text-center">
<form action="/login_check" method="post" id="login__form">
<div class="form-group">
<label for="login__form--username">Saisissez votre Login</label>
<input type="text" name="_username" value="" class="form-control"
placeholder="NNI" id="login__form--username"
title="Saisissez votre Login" required="" autofocus="">
</div>
<div class="form-group">
<label for="login__form--password">Saisissez votre mot de passe </label>
<input type="password" name="_password" class="form-control"
placeholder="Mot de passe " id="login__form--password"
title="Saisissez votre mot de passe " required="">
</div>
<input title="S'identifier" class="center-block" type="image" src="/images/button_validation.png" name="submit" id="login__form-submit"/>
</form>
</div>
</div>
</div>
Les logs d’asqatasun:
19-09-2018 16:45:51:562 418043 WARN com.sebuilder.interpreter.SeInterpreter - org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"id","selector":"login__form--username"}
Build info: version: '2.39.0', revision: '14fa800511cc5d66d426e08b0b2ab926c7ed7398', time: '2013-12-16 13:18:38'
System info: host: 'monhost', ip: 'mon ip', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.9.1.el7.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: unknown
19-09-2018 16:45:51:564 418045 WARN com.sebuilder.interpreter.SeInterpreter - Unable to locate element: {"method":"id","selector":"login__form--username"}
Command duration or timeout: 60.10 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
....
19-09-2018 16:23:06:861 115446 WARN com.sebuilder.interpreter.SeInterpreter - org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"xpath","selector":"//input[@id='login__form--username']"}
Build info: version: '2.39.0', revision: '14fa800511cc5d66d426e08b0b2ab926c7ed7398', time: '2013-12-16 13:18:38'
System info: host: 'monhost', ip: 'mon ip', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.9.1.el7.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: unknown
19-09-2018 16:23:06:866 115451 WARN com.sebuilder.interpreter.SeInterpreter - Unable to locate element: {"method":"xpath","selector":"//input[@id='login__form--username']"}
Command duration or timeout: 60.10 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
....
19-09-2018 16:41:18:220 144701 WARN com.sebuilder.interpreter.SeInterpreter - org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"css selector","selector":"#login__form--username"}
Build info: version: '2.39.0', revision: '14fa800511cc5d66d426e08b0b2ab926c7ed7398', time: '2013-12-16 13:18:38'
System info: host: 'monhost', ip: 'mon ip', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-862.9.1.el7.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: unknown
19-09-2018 16:41:18:225 144706 WARN com.sebuilder.interpreter.SeInterpreter - Unable to locate element: {"method":"css selector","selector":"#login__form--username"}
Command duration or timeout: 60.08 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Testé en local avec Firefox 52.0.1 (32 bits), et Selenium Builder 2.3.5, Les trois scénarios fonctionnent
La version d’asqatasun est la 4.0.3, elle tourne sur un serveur Tomcat v7, Centos 7.5 et BDD Mariadb dans un conteneur Docker.
La page de login n’a pas de frames, j’ai testé également avec un wait plus long sans résultalt.
Si quelqu’un pourrait m’aider.
Merci d’avance
@tyeponte