简体   繁体   中英

Rerun web automation with loop command selenium python

Pycharm Pro version has an option to rerun crashed tests. I do not have the luxury to afford the pro version so Im using the community version which does not have the rerun test option(to my knowledge).

My script has no problems but the webpage that Im using after a few hours will refresh and log the user out such that the commands in my script return :element not found.

I tried using the method of handle error to rerun the whole script and open a new browser after such an incident. The problem is that the test runs without even running the contents:

 i =10 while i<10: # get_webpagage_and_login_so_forth try: # dosomething() except: pass

I expected after the script crashes it will pass and return to the first loop of opening a new browser but it does not. Please help. excuse my shortened version of code

如果您使用的是pytest您可以使用此插件将测试标记为pytest以在测试失败后重新运行: https : //github.com/box/flaky

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM