[英]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.