'Selenium turning off on redirection problem

I have a problem with my selenium script. Basicly what is it supposed to do is click an element that redirects you to a completly different page (url and everything), then login on that page, and then click a button that redirects you back. Whenever i click the first button though, the script turns off, as if the selenium thought the original page was turned off so the script should be turned off too. What do I do to stop that? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source