Modifying the recorded script exported from Selenium IDE
The Pytest framework is required to execute a Python script recorded in a Selenium IDE. Modify your script to remove this dependency so that the script executes without the Pytest framework.
To modify the recorded script
The following video (1:26) illustrates how you modify a script exported from a Selenium IDE to use in BMC PATROL for Synthetic Monitoring.
- Open the recorded Python script file in an editor.
- Remove the import pytest statement.
- Create an object of the generated class.
For example:
doc_object = TestDoctest(); - Use the object to call the methods of the generated class inside the try and finally statements.
For example:
try:
doc_object.setup_method('')
doc_object.test_doctest()
finally:
doc_object.teardown_method('') Save the changes that you made to the script file and it is ready to use in PATROL for Synthetic Monitoring.
The following table shows a recorded script before and after modification:
Before modifying a recorded script | After modifying a recorded script |
---|---|
# Generated by Selenium IDE class TestDoctest(): | # Generated by Selenium IDE class TestDoctest(): |