Giter Club home page Giter Club logo

imt-dsl's Introduction

A DSL for browser automation

Avancement

Nous avons implémenté toute la grammaire xtext ainsi que l'ensemble du code xtend correspondant pour la génération de code final Java.

Néanmoins, par manque important de temps le code Java généré pour les exemples 7 et 8 n'est pas totalement correct.

De plus, le bon fonctionnement avec lancement de Selenium n'a été testé que pour les exemples 1 à 3.

Elements explicatifs

Pour tester le bon fonctionnement du code Selenium généré, nous écrivons un fichier de test unitaire.

Le projet Java test-selenium montre notamment un exemple de code fonctionnel, celui de l'exemple test1.sn.

DSL syntax

Selector

<HTML TAG>[<HTML ATTRIBUTE>*]

Returns the first DOM element matching conditions.

To retrieve all elements matching conditions add .all extension.

Elements
HTML tag button, a, body, checkbox, input, img, ...
HTML attribute href, text, class, id, checked, ...

Examples

a[text="Toutes les actualités"]
div[id="test", class="views-row"]
img[alt="Accueil"]
div[class="views-row"].all

Projection

<SELECTOR>.<ATTRIBUTE>

Elements
Attribute value, html, ...

Apply a projection to a selector.

Examples

body[].html
p[].value
div[class="views-row"].all

Action

<ACTION> <SELECTOR> <PARAMETERS>*

Elements
Action click, fill, choose, count, ...

Proceed to an action on a specific selector.

Examples

click checkbox[checked="true"].all
click button[text="Appliquer les filtres"]
choose select[text="Le mois dernier"]
fill input[type="text"] "2007"
count div[class="views-row"].all

Assignment

assign <*> <VARIABLE>

Assign an element (selector, string, ...) to a new variable.

Examples

assign 3 nbResults
assign img[alt="Imprimer"] imageImprimer

Navigation

<ACTION> <STRING>

Elements
Action openBrowser, go

Examples

openBrowser "firefox"
go "http://www.imt-atlantique.fr/fr/rechercher"

Function

def <FUNCTION NAME>(<FUNCTION PARAMETER>*) { <STATEMENTS> }

Define a function containing multiple statements.

A function auto-returns the result of the last statement.

Examples

def countResults() {
  count div[class="views-row"].all
}

Assertion

assert <ELEMENT> = <ELEMENT>

assert <ELEMENT> contains <ELEMENT>

Assert that a condition is true.

Full example

def checkPrintable(name) {
  go "http://www.imt-atlantique.fr/fr"
  click a[text=name]
  assign img[alt="Imprimer"] imageImprimer
  assert body[].html contains imageImprimer
  click imageImprimer
}
def main {
  openBrowser "chrome"
  checkPrintable("COMMUNIQUÉS DE PRESSE")
  checkPrintable("DOSSIERS DE PRESSE")
}

imt-dsl's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.