Package: play-selenium
pytest-play plugin driving browsers using Selenium/Splinter under the hood.
Selenium grid compatible and implicit auto wait actions for more robust scenarios with less pain.More info and examples on:pytest-play, documentationcookiecutter-qa, seepytest-playin action with a working example if you want to start hackingBrowser based commandsBrowser based commands here.play_seleniumsupports by default browser interactions. For example it can be used for running seleniumsplinterscenarios driving your browser for your UI test or system tests.play_seleniumis also your friend when page object approach (considered best practice) is not possible. For example:limited time, and/orlack of programming skillsInstead if you are interested in a page object pattern have a look atpypom_formorpypom.play_seleniumsupports automatic waiting that should help to keep your tests more reliable with implicit waits before
moving on. By default it waits for node availability and visibility but it supports also some wait commands and
wait until a given Javascript expression is ok. So it is at the same time user friendly and flexible.Conditional commands (Javascript)Based on a browser level expression (Javascript):- type: clickElement
  provider: selenium
  locator:
    type: css
    value: body
  condition: "'$foo' === 'bar'"Supported locatorsSupported selector types:cssxpathtagnametextidvalueOpen a pageWith parametrization:- type: get
  provider: selenium
  url: "$base_url"or with a regular url:- type: get
  provider: selenium
  url: https://google.comPauseThis command invokes a javascript expression that will
pause the execution flow of your commands:- type: pause
  provider: selenium
  waitTime: 1500If you need a pause/sleep for non UI tests you can use thesleepcommand provided by theplay_pythonplugin.Click an element- type: clickElement
  provider: selenium
  locator:
    type: css
    value: bodyFill in a text- type: setElementText
  provider: selenium
  locator:
    type: css
    value: input.title
  text: text valueInteract with select input elementsSelect by label:- type: select
  provider: selenium
  locator:
    type: css
    value: select.city
  text: Turinor select by value:- type: select
  provider: selenium
  locator:
    type: css
    value: select.city
  value: '1'Eval a Javascript expression- type: eval
  provider: selenium
  script: alert('Hello world!')Create a variable starting from a Javascript expressionThe value of the Javascript expression will be stored inplay.variablesunder the namecount:- type: storeEval
  provider: selenium
  variable: count
  script: document.getElementById('count')[0].textContentAssert if a Javascript expression matchesIf the result of the expression does not match anAssertionErrorwill be raised and the test will fail:- type: verifyEval
  provider: selenium
  value: '3'
  script: document.getElementById('count')[0].textContentVerify that the text of one element contains a stringIf the element text does not contain the provided text anAssertionErrorwill be raised and the test will fail:- type: verifyText
  provider: selenium
  locator:
    type: css
    value: ".my-item"
  text: a textSend keys to an elementAllselenium.webdriver.common.keys.Keysare supported:- type: sendKeysToElement
  provider: selenium
  locator:
    type: css
    value: ".confirm"
  text: ENTERSupported keys:KEYS = [
    'ADD', 'ALT', 'ARROW_DOWN', 'ARROW_LEFT', 'ARROW_RIGHT',
    'ARROW_UP', 'BACKSPACE', 'BACK_SPACE', 'CANCEL', 'CLEAR',
    'COMMAND', 'CONTROL', 'DECIMAL', 'DELETE', 'DIVIDE',
    'DOWN', 'END', 'ENTER', 'EQUALS', 'ESCAPE', 'F1', 'F10',
    'F11', 'F12', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8',
    'F9', 'HELP', 'HOME', 'INSERT', 'LEFT', 'LEFT_ALT',
    'LEFT_CONTROL', 'LEFT_SHIFT', 'META', 'MULTIPLY',
    'NULL', 'NUMPAD0', 'NUMPAD1', 'NUMPAD2', 'NUMPAD3',
    'NUMPAD4', 'NUMPAD5', 'NUMPAD6', 'NUMPAD7', 'NUMPAD8',
    'NUMPAD9', 'PAGE_DOWN', 'PAGE_UP', 'PAUSE', 'RETURN',
    'RIGHT', 'SEMICOLON', 'SEPARATOR', 'SHIFT', 'SPACE',
    'SUBTRACT', 'TAB', 'UP',
]Wait until a Javascript expression matchesWait until the given expression matches or raise aselenium.common.exceptions.TimeoutExceptionif takes too time.At this time of writing there is a global timeout (20s) but in future releases
you will be able to override it on command basis:- type: waitUntilCondition
  provider: selenium
  script: document.body.getAttribute('class') === 'ready'Wait for element present in DOMPresent:- type: waitForElementPresent
  provider: selenium
  locator:
    type: css
    value: bodyor not present:- type: waitForElementPresent
  provider: selenium
  locator:
    type: css
    value: body
  negated: trueWait for element visibleVisible:- type: waitForElementVisible
  provider: selenium
  locator:
    type: css
    value: bodyor not visible:- type: waitForElementVisible
  provider: selenium
  locator:
    type: css
    value: body
  negated: trueAssert element is present in DOMAnAssertionErrorwill be raised if assertion fails.Present:- type: assertElementPresent
  provider: selenium
  locator:
    type: css
    value: div.elemor not present:- type: assertElementPresent
  provider: selenium
  locator:
    type: css
    value: div.elem
  negated: trueAssert element is visibleAnAssertionErrorwill be raised if assertion fails.Present:- type: assertElementVisible
  provider: selenium
  locator:
    type: css
    value: div.elemor not present:- type: assertElementVisible
  provider: selenium
  locator:
    type: css
    value: div.elem
  negated: trueTwitterplay_seleniumtweets happens here:@davidemoroChangelog0.0.3 (2019-06-26)according to newpytest-playversions (>= 2.0) theself.engine.parametrizeshould
be used instead of accessingself.engine.parametrizer0.0.2 (2019-02-18)Remove pytest version constraint (added compatibility with pytest>=4)0.0.1 (2019-01-25)Supports new pytest-play >= 2.0 YAML based syntax (json no more supported)