[英]Capturing URL while Selenium Tests run
i am automating using selenium webdriver and C#. 我正在使用Selenium Webdriver和C#实现自动化。 Is there a way to capture all urls that my browser navigates to while my Selenium automation tests run using an external tool such as Fiddler core / wireshark. 当使用外部工具(例如Fiddler core / wireshark)运行Selenium自动化测试时,是否可以捕获浏览器导航到的所有URL。 I mean while my tests continue to run, I would like some of these tools to capture my urls parallely so that incase my tests fail, i could investigate further by using the final few urls(from the point of failure) to debug the issue. 我的意思是,当我的测试继续运行时,我希望其中一些工具能够并行捕获我的网址,以防万一我的测试失败,我可以通过使用最后几个网址(从失败的角度)来进一步调查问题。
Is this really possible. 这真的有可能吗? Do I need to use a separate thread to one of these tools(Fiddler/wireshark/any other tool) to capture the url? 我是否需要对这些工具之一(Fiddler / wireshark /任何其他工具)使用单独的线程来捕获URL?
Can this really be done 真的可以做到吗
There are a few options. 有一些选择。
driver.Url
and stores it into a list. 编写一些执行driver.Url
包装器代码,并将其存储在列表中。 This wrapper code would check to see if the driver.Url
is different from the last stored entry in the object and if it is different then it would add it to the list. 该包装器代码将检查driver.Url
是否与对象中最后存储的条目不同,如果不同,则将其添加到列表中。 All have pros and cons. 都有优点和缺点。 3 would give you the most control as your test itself would gather the URL's and maintain a list in code that you can do what you want with. 3将给您最大的控制权,因为您的测试本身将收集URL并在代码中维护一个列表,您可以根据自己的意愿进行操作。 1 of course would give you the most robust details, depending on how you setup wireshark, and you can profile the entire machine and network experience. 当然,1将为您提供最可靠的详细信息,具体取决于您设置wireshark的方式,并且可以描述整个计算机和网络的体验。 2 is a middle ground where your test still drives it, but the results are separate...but being part of the browser you would have to avoid cleanup after your tests...if you have more tests than one execute at a time this could cause alot of problems... 2是测试仍将其驱动的中间立场,但结果是分开的...但是作为浏览器的一部分,您必须避免在测试后进行清理...如果您一次执行的测试多于一次可能会导致很多问题...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.