PHPackages                             jeremy379/json-to-selenium - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. jeremy379/json-to-selenium

ActiveLibrary[Testing &amp; Quality](/categories/testing)

jeremy379/json-to-selenium
==========================

Allow to run test on selenium by sending Json file

v1.21(7y ago)036GPL-3.0+PHPPHP &gt;=7.0.0

Since Oct 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jeremy379/json-to-selenium)[ Packagist](https://packagist.org/packages/jeremy379/json-to-selenium)[ RSS](/packages/jeremy379-json-to-selenium/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Selenium from JSON
==================

[](#selenium-from-json)

Start library and get results
-----------------------------

[](#start-library-and-get-results)

```
$selenium = new Selenium('127.0.0.1');
$play = new Selenium\Play($selenium, $playJson, $testJson, $withScreenShot = true);
$play->play();

$selenium->stop();

```

### Generate JSON

[](#generate-json)

#### PlayJson

[](#playjson)

- The play JSON can be generated with the chrome extension for chrome available here
- The JSON generated can be directly send here

    - ! We handle only the following event : open, click, select, type, selectFrame, runScript, sleep (extra command to sleep x seconds before continuing)
    - ! We handle these selector: id, css (=css selector, not the class), name, linkText, xpatch
- Example of a JSON

    - If you want to generate it by yourself, we need these main key: url, test.commands.command, test.commands.target, test.commands.value

    ```
    {
      "id": "85965227-ebc5-4c5a-8845-4ee0592b4bcc",
      "version": "1.1",
      "name": "Untitled Project",
      "url": "https://dillenbourg.be",
      "tests": [{
        "id": "c6d66c1b-6650-40e0-b238-da302b674599",
        "name": "Untitled",
        "commands": [{
          "id": "a1fb6886-949d-417f-8e5a-4344ebb1e6e2",
          "comment": "",
          "command": "open",
          "target": "/",
          "targets": [],
          "value": ""
        }, {
          "id": "d247b938-d99b-4e9f-ab7a-95a211e8aa27",
          "comment": "",
          "command": "click",
          "target": "linkText=Interactive version",
          "targets": [
            ["linkText=Interactive version", "linkText"],
            ["xpath=//a[contains(text(),'Interactive version')]", "xpath:link"],
            ["xpath=//a[contains(@href, 'command')]", "xpath:href"],
            ["xpath=//a", "xpath:position"]
          ],
          "value": ""
        }, {
          "id": "f58cafc0-3e39-42d9-a3a8-73247813cd6f",
          "comment": "",
          "command": "editContent",
          "target": "css=#command-line-2 > span.highlighting_white",
          "targets": [
            ["css=#command-line-2 > span.highlighting_white", "css"],
            ["xpath=//p[@id='command-line-2']/span[3]", "xpath:idRelative"],
            ["xpath=//p[3]/span[3]", "xpath:position"]
          ],
          "value": "cat"
        }, {
          "id": "88a8e230-3f29-48e7-bde6-6749b1c705b7",
          "comment": "",
          "command": "editContent",
          "target": "css=#command-line-3 > span.highlighting_white",
          "targets": [
            ["css=#command-line-3 > span.highlighting_white", "css"],
            ["xpath=//p[@id='command-line-3']/span[3]", "xpath:idRelative"],
            ["xpath=//p[5]/span[3]", "xpath:position"]
          ],
          "value": "gif"
        }]
      }],
      "suites": [{
        "id": "dd50d3df-ec78-4d90-80a7-627bf73a1df6",
        "name": "Default Suite",
        "persistSession": false,
        "parallel": false,
        "timeout": 300,
        "tests": ["c6d66c1b-6650-40e0-b238-da302b674599"]
      }],
      "urls": ["https://dillenbourg.be/"],
      "plugins": []
    }

    ```

#### TestJson

[](#testjson)

- The test JSON is a Json defining a list of test to execute at each step of the playJson.
- Step start counting at 1 and a test JSON can look like that

    ```
    [
       1 => [
           [
               'operation'     => 'page_title',
               'target_prefix' => null,
               'target'        => null,
               'expected'      => 'dillenbourg'
           ],
           [
               'operation'     => 'target_content_match',
               'target_prefix' => 'css=',
               'target'        => 'a.myfirstlink',
               'expected'      => 'click here'
           ]
       ],
       2   => [
           ...
       ]

    ]

    ```
- target\_prefix can be one of these

    Prefixtarget valuecss=any valid css selectorid=Any ID in the pagename=Name of an attributelinkText=Looking by the text on a link (first one is matched)xpath=any valid Xpath
- Operations can be

    Operationsinfopage\_titlecheck if the title of the page is the one in "expected"target\_existsCheck if the target existstarget\_contentCheck if the target has the content in expectedtarget\_content\_matchCheck if the target match the content in expected. A regex is expectedcount\_target\_elementCheck if the element is at least "expected" times in the pagelink\_validCheck if the link of the target is valid (HTTP status 200)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2770d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2dd11563c30299f3c61e050728740580a889f0b286cd1c7c28f88acc0bcfc5f9?d=identicon)[jeremy379](/maintainers/jeremy379)

---

Top Contributors

[![jeremy379](https://avatars.githubusercontent.com/u/5048337?v=4)](https://github.com/jeremy379 "jeremy379 (1 commits)")

### Embed Badge

![Health badge](/badges/jeremy379-json-to-selenium/health.svg)

```
[![Health](https://phpackages.com/badges/jeremy379-json-to-selenium/health.svg)](https://phpackages.com/packages/jeremy379-json-to-selenium)
```

###  Alternatives

[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[ikwattro/guzzle-stereo

Guzzle Recorder for recording Request/Responses and replay them back in a Mock

782.6k1](/packages/ikwattro-guzzle-stereo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
