Collecting accuracy and availability attributes
Collect the error details related to the accuracy and availability of your application by defining the accuracy errors and availability errors criteria in a script. Accuracy errors are determined based on content validation, title validation, and response data verification.
Availability errors occur when the application does not respond or when the application responds with an error indicating it is unavailable.
To collect accuracy and availability attributes by using the Selenium framework
The following video (2:42) illustrates how you collect attributes in BMC PATROL for Synthetic Monitoring.
Use the following functions in the script to get the accuracy errors based on the title and data verification.
- For the title verification:
driver.verify_title("<title to verify>")
- For the data verification:
driver.verify_data("<content to verify>")
Call the driver.verify_data() method multiple times to verify multiple data strings.
In the following script example, we verify the title and data on a webpage.
from selenium import webdriver
from STMWebDriver import STMWebDriver
options = webdriver.ChromeOptions()
options.add_argument("--disable-gpu")
options.add_argument("--headless")
driver = STMWebDriver.Chrome(options=options)
try:
driver.verify_title('Documentation')
driver.verify_data('BMC Product Documentation')
driver.get('https://docs.bmc.com/docs/')
finally:
driver.close()
driver.quit()
To collect accuracy and availability attributes by using the Playwright framework
To get the accuracy, availability, and page timers, import the following module in the script:
import BMCHelixPlaywright
In the following script example, we verify the title and data on a webpage.
from BMCHelixPlaywright import BrowserWrapper
with sync_playwright() as p:
try:
browser = p.chromium.launch()
# create instance of BrowserWrapper using browser object
bmcBrowser = BrowserWrapper(browser)
context = bmcBrowser.new_context()
page = context.new_page()
#Verify title and data for accuracy errors
page.verify_title('Dashboard - BMC Documentation')
page.verify_data('Documentation')
page.goto("https://docs.bmc.com/docs/")
except Exception as e:
print(f"error:{e}")
finally:
bmcBrowser.close()