Using remoteWebDriver, can I change the time on the executing system?
morde last edited by
I'm trying to functional test some code that is dependent on reading the client date, and I want to validate that it does so correctly. Locally, I can change my system date using Java and run the test using Selenium, but I want to run my tests with RemoteWebDriver. Is there some way I can change the date on the client system? If not, can I spoof the date somehow?
inna last edited by
In short the answer is no, because the webDriver is exactly that. It drives a browser. It does not know how to communicate with the system level APIs. Before I go into something that could help you, I'd like to point out that if your Selenium test is so specific that it requires the system date to change then that is a major 'test smell' to me. If it is possible then I would consider automating that with a 'unit' or 'integration' test. If you don't have access to the source code and you absolutely must automate this test with Selenium then you can look into a Java library that allows you to run a shell command. I don't know what operating system you're running otherwise I'd point you to something specific, but I'd recommend googling "How to change date on remote machine with Java"