[英]How can I write a selenium script with c# and automate it to find the downtime and uptime of a website?
I am an automated tester in selenium and c# (not the greatest developer) but I have been tasked to find out the uptime and downtime of the website.我是 selenium 和 c# 的自动化测试人员(不是最伟大的开发人员),但我的任务是找出网站的正常运行时间和停机时间。 Now I guess this script would be run everyday because my scripts run on a build server at 00.05am every night.
现在我猜这个脚本会每天运行,因为我的脚本每天晚上 00.05 在构建服务器上运行。 So my question is how do I get the numbers?
所以我的问题是如何获得数字? I have found a pretty good post on here which is similar but what I don't understand is, how to get the availability/uptime over a period of time?
我在这里找到了一个很好的帖子,它很相似,但我不明白的是,如何在一段时间内获得可用性/正常运行时间? How did he get 86400)/100) * 97.91m?
他是怎么得到 86400)/100) * 97.91m 的? Check out the code guys
检查代码的家伙
CultureInfo provider = CultureInfo.InvariantCulture;
DateTime first = DateTime.ParseExact("20.04.2015", "dd.MM.yyyy", provider);
DateTime last = DateTime.ParseExact("26.04.2015", "dd.MM.yyyy", provider);
TimeSpan time = last - first;
decimal secondsUptime = ((time.Days * 86400)/100) * 97.91m; //97.91 is the uptime calculated above for the time period.
// The problem is how to get this?
decimal secondsDowntime = ?
So the guy had problems getting the downtime and the posts answer was this:所以这个人在停机时遇到了问题,帖子的答案是这样的:
decimal PercentDownTime = 100 - PercentUpTime;
decimal SecondsUpTime = (time.Seconds / 100) * PercentUpTime;
decimal SecondsDownTime = (time.Seconds / 100) * PercentDownTime;
This is ideally a monitoring problem.理想情况下,这是一个监控问题。 You may not need selenium for this.
为此,您可能不需要硒。 Few ways could be
几种方法可能是
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.