Reputation: 101
I am currently using Chromedriver to webcrawl the connection from a local machine. The script that I'm running is automated using the window task scheduler at 11:00 a.m everyday. However, if the machine is not turned on at that moment, the webdriver will not be able to load the webpage (from the machine's IP). After a while (30s), the webdriver will timeout and the program will stop.
However, the window that was opened to try and load the webpage will not be closed. Is there any way to make it so the window will close if the page experiences a timeout?
Upvotes: 0
Views: 1146
Reputation: 1089
In case you are using a testing framework (aka JUnit, TestNG, Mocha, pytest), there is a possibility to use a dedicated method for post test execution.
For example, in Java with JUnit5 it would be:
@AfterEach
void closeBrowser() {
driver.quit();
}
Upvotes: 1