If you’re just getting started in mabl, you can migrate tests from Playwright or Selenium into mabl with the mabl tests import command.
mabl tests import playwright
The mabl tests import playwright command imports existing Playwright tests into mabl.
For a step-by-step guide on how to import Playwright tests, click here.
Options
| Option | Details |
|---|---|
| --auto-save | Automatically save tests in mabl when the migration is complete |
| --workspace-id | ID of the mabl workspace to import tests to. Use this option if you belong to multiple mabl workspaces. |
| --path | Path to the Playwright test that you want to import. The current directory is the default path. |
| --project | Path to the Playwright project that you want to run. This project must have tracing enabled. mabl converts the baseURL of this Playwright project into the application URL in the imported mabl test(s). |
| --grep | Grep argument to pass to Playwright to filter tests. In Playwright, tag the tests you want to import to mabl. For example, if you add a “mabl” tag to a Playwright test, you can run the --grep flag with “mabl” |
| --extra-arguments | Extra arguments that you can pass to Playwright, such as running in headless mode |
| --tests-path | Path where tests are located. The default is “tests”. |
| --trace-file | Path of a single Playwright trace.zip file to import |
| --trace-path | Path of the directory containing Playwright trace files to import |
Examples
# Import the Playwright test in current directory
mabl tests import playwright --project chromium
# Import Playwright tests that have a "mabl" tag
mabl tests import playwright --project chromium --grep "mabl"After importing tests, we strongly recommend choosing the Run tests and activate auto-heal option in the mabl CLI. This option converts Playwright custom find steps into mabl steps so that your tests can reap the full benefits of Configure Find, auto-heal, or Intelligent Wait.
Limitations
Note the following limitations for imported Playwright tests:
- Variables, code blocks, if statements, and loops are not migrated during the import session.
- mabl tests do not support Playwright’s array assertions or assertions that use regular expressions.
mabl tests import selenium
The mabl tests import selenium command imports existing Selenium tests into mabl. It runs a local HTTP proxy between your existing Selenium test and the Selenium server, captures the WebDriver session, and hands the capture off to mabl’s cloud test authoring agent, which authors the corresponding mabl test asynchronously.
For a step-by-step guide on how to import Selenium tests, click here.
Options
| Option | Details |
|---|---|
--auto-save |
Submit captured sessions to mabl without prompting for confirmation. Useful in scripts and CI. |
--multi |
Import multiple tests at once. The proxy keeps listening across Selenium sessions until you press CTRL+C. |
--name, -n
|
The name to give this test in mabl. When importing multiple tests with --multi, this name is applied to all of them. |
--port |
The port on which the Selenium proxy should listen. The default is 8889. |
--workspace-id, -w
|
ID of the mabl workspace to import tests to. Use this option if you belong to multiple mabl workspaces. |
--credentialsId |
Workspace credential ID to bind to the imported test. Use this when your captured login pulls secrets from a vault or environment-specific config that doesn’t match any mabl credential. Without it, the planner has no signal for which credential to pick. |
--useLink |
Bias the planner toward applications and environments configured for the mabl Link Agent. Set this when the application under test requires Link Agent connectivity even if that isn’t obvious from the recording. |
--no-plan |
Skip the test planning agent and submit the captured session directly to the cloud test authoring agent. Faster, but the authoring agent picks the application and environment itself with less workspace context. |
Examples
# Import a test and name it "My imported test"
mabl tests import selenium --name "My imported test"
# Import multiple tests at once
mabl tests import selenium --multi
# Bind the imported test to a specific mabl workspace credential
mabl tests import selenium --credentialsId [credential-id]
# Import an application that requires the mabl Link Agent
mabl tests import selenium --useLinkExpected output
After your Selenium test ends, the CLI submits the captured session to the mabl cloud test authoring agent and outputs a link to the running authoring session. From there you can watch the test get authored in real time; the finished test appears in your workspace when authoring completes.
Configure your test to use a selenium proxy at localhost:8889 and run the test now.
Import will end automatically when the Selenium session is closed or CTRL+C is pressed
{test output here}
Captured 1 test.
? Submit 1 captured session to mabl for test authoring? (Y/n) Yes
Submitting session to mabl for test generation (planning enabled)...
Test authoring session initiated: session={session-id} instance={instance-id}
https://app.mabl.com/workspaces/{workspace-id}/agents/tasks/{session-id}Import is asynchronous: the CLI returns as soon as the cloud authoring session has been initiated and does not block waiting for the test to be authored.
After importing
The cloud test authoring agent authors a complete mabl test from your captured Selenium session. A few things are inherently invisible to the proxy and may need to be added manually after authoring:
- Assertions made inside your test process (the proxy only sees WebDriver traffic, not in-process
assertEqualscalls. Use the Selenium Java Agent if your test’s intent depends on in-process assertions) - File downloads and uploads
- Drag and drop actions
- Hover actions
- Steps that interact with elements inside an
- Cookie inspection
Edit the test in the mabl Trainer to add any of these that your test needs.