Initial commit - Selenium automation framework
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
def log_step(driver, request, step_name):
|
||||
|
||||
screenshots_dir = "reports/screenshots"
|
||||
os.makedirs(screenshots_dir, exist_ok=True)
|
||||
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
filename = f"{step_name}_{timestamp}.png"
|
||||
|
||||
filepath = os.path.join(screenshots_dir, filename)
|
||||
|
||||
driver.save_screenshot(filepath)
|
||||
|
||||
if hasattr(request.node, "extra"):
|
||||
import pytest_html
|
||||
request.node.extra.append(pytest_html.extras.image(filepath))
|
||||
|
||||
print(f"STEP: {step_name}")
|
||||
Reference in New Issue
Block a user