如何使用Java使用Selenium WebDriver捕获JavaScript错误 [英] How to capture JavaScript errors with Selenium WebDriver using Java

查看:166
本文介绍了如何使用Java使用Selenium WebDriver捕获JavaScript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以在运行自动Selenium测试时捕获页面上的JavaScript错误.

I was wondering if there is a way to capture JavaScript errors on a page while running automated Selenium tests.

推荐答案

将为您提供控制台内容.

Will give you the console content.

然后,您可以使用 Level

LogEntries entries = driver.manage().logs().get(LogType.BROWSER);
entries.filter(Level.SEVERE);

这篇关于如何使用Java使用Selenium WebDriver捕获JavaScript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆