Skip to content

Commit 627b04a

Browse files
Merge pull request #229 from AutomationSolutionz/metrics_fix
[Fix] try-except added for first-contentful-paint metric
2 parents 803c209 + e9465f7 commit 627b04a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Framework/Built_In_Automation/Web/Selenium/BuiltInFunctions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,10 @@ def Go_To_Link(step_data, page_title=False):
976976
if current_driver_id not in CommonUtil.browser_perf:
977977
metrics = selenium_driver.execute_cdp_cmd('Performance.getMetrics', {})
978978
metrics_dict = {data["name"]: data["value"] for data in metrics["metrics"]}
979-
metrics_dict["first-contentful-paint"] = selenium_driver.execute_script('return performance.getEntriesByName("first-contentful-paint")[0].startTime')
979+
try:
980+
metrics_dict["first-contentful-paint"] = selenium_driver.execute_script('return performance.getEntriesByName("first-contentful-paint")[0].startTime')
981+
except:
982+
metrics_dict["first-contentful-paint"] = 0
980983
CommonUtil.browser_perf[current_driver_id] = [metrics_dict]
981984
return "passed"
982985
except:

0 commit comments

Comments
 (0)