Do not wait for page to load

我与影子孤独终老i 提交于 2019-12-04 01:40:25

问题


My problem is that the site from which I have to fetch data is taking too much time in loading which increases the execution time of my testcase. I don't want to wait for whole site to load. What can I do? I have used timeout of 30 sec but it doesn't throw exception even if time is exceeded. May be all the javascripts are called in the onload event of webpage. It is very important to decrease the execution time of the test case, I have just started working with selenium and don't have thorough knowledge, please help me out


回答1:


Using FireFox you can try webdriver.load.strategy = unstable. Maybe it will suits you.
Check here.

Unfortunately usually webdriver waits for whole page to be loaded. I got similar problem with testing pages like Youku - sometimes 3min it's not enough to get content.

You can also try with:
IJavaScriptExecutor js = (IJavaScriptExecutor)Driver; js.ExecuteScript("return window.stop");
It worked for me locally although on VMs I had still the same problem.



来源:https://stackoverflow.com/questions/22404581/do-not-wait-for-page-to-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!