0

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

2
  • script has no problems but the webpage that Im using after a few hours will log the user out such that the commands in my script return :element not found. by this do you mean your script run for hours? Think to refactor your code. Commented Sep 19, 2020 at 9:26
  • Hi Dev, Im still new to coding and do not understand your statement. It be the phrasing of my question. What I mean is, after a few hours the webpage will refresh to a new different page. Manually after this happens I just rerun the test. but Im looking for an automated way to do this Commented Sep 19, 2020 at 9:33

1 Answer 1

1

If you're using pytest you can mark tests flaky to rerun after they fail using this plugin: https://github.com/box/flaky

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.