简体   繁体   English

如何使用Selenium WebDriver C#自动创建文本文件并在其中写入异常

[英]How to create Text file and write exceptions in it automatically using Selenium WebDriver C#

i am using selenium web-driver in c#, i want to Create a text/ log file and write exception in it automatically. 我在c#中使用selenium web-driver,我想创建一个文本/日志文件并自动在其中写入异常。 right now i am doing testing on log in page. 现在我正在登录页面进行测试。 if i change the password then the exception should be written in text file with time stamp. 如果我更改密码,则应将异常写入带有时间戳的文本文件中。

I would recommend using log4net ( http://logging.apache.org/log4net/ ) it's a pretty straight forward logging library. 我建议使用log4net( http://logging.apache.org/log4net/ )这是一个非常简单的日志记录库。 Selenium doesn't really have any impact on your logging. Selenium对您的日志记录没有任何影响。 You handle exceptions the same and put logging statements in the catch's as you normally would. 您可以像往常一样处理异常并将日志语句放入catch中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用带有C#的Selenium WebDriver将数据写入Excel文件? - How to write data into an Excel file using Selenium WebDriver with C#? 如何使用Selenium Webdriver和C#创建日志文件? - How to create a log file using selenium webdriver and C#? 在C#中使用Selenium Webdriver,如何选择要写入的文本框,然后写入? - Using Selenium Webdriver in C#, how do I select a text box to write in, then write in it? 如何使用C#创建文本文件并向其中写入数据? - How to create a text file & write data to it using C#? 如何使用 selenium c# webdriver 重命名下载的文件 - How to rename downloaded file using selenium c# webdriver 如何在C#中使用Selenium WebDriver执行本地javascript文件 - How to execute local javascript file using selenium webdriver in C# 如何在C#硒webdriver中自动滚动Div? - How to scroll the Div automatically in C# selenium webdriver? Selenium WebDriver自动引发TimeoutException-C# - Selenium WebDriver Automatically Throws TimeoutException - C# 如何使用 C# 在 Selenium WebDriver (Selenium 2) 中最大化浏览器窗口? - How to maximize the browser window in Selenium WebDriver (Selenium 2) using C#? 使用Selenium WebDriver和C#从此范围获取元素文本 - Get element text from this span using Selenium WebDriver and C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM