I have a couple of scripts (two in Python, one in Java) that use Selenium to drive a browser and download files from a website.I need to do some major refactoring before I do a major expansion, so I want to start by writing tests, but I don't know how to go about doing it. All my search results lead to articles about using Selenium to test websites, and I want to test the Selenium script itself.In particular, I don't want running my tests to create a significant load on the target website.The offline parts of it I can test pretty easy, but I need to know how to test the actual browser driving itself.Any ideas?
How to write tests for browser automation script
testing;browser;selenium
The ideal way to test this without creating any load on the target site would be to create a duplicate of that target web site on your own web server. The duplicate should be a simulation which behaves as similar as possible as the target web site itself. However, if the target site is a complex third party site, this may be impractical or nearly impossible.So another approach is to implement a testing mode into your selenium script which omits any steps which can produce heavy load. For example, instead of really downloading files from the site, in testing mode the script could just create some dummy test files in the target folder instead of downloading anything. That way, you can test major parts of the script without producing heavy load. Only when you know that all these parts are working fine, you disable testing mode and test the (hopefully) small remaining part which is responsible for executing the real download.