1

The problem i am trying to solve is this: my home security system does not have a scheduling option and I frequently forget to switch on the system.

I am considering writing a python script that can open a browser, login to the website and click on buttons to activate the home alarm.

I see selenium recommended for automating browser and site action. I wonder though if these two tools can:

  1. be scheduled to run even my computer is sleeping?
  2. automate the whole nine yards - from opening the browser to button clicks to logging off?

I am new to the world of selenium / automation - appreciate any response. Thanks.

1
  • 1
    It is possible and easy to write a python script in selenium to automatically open a browser window, load pages and click buttons. But it is not possible to execute a code while your computer is in sleep mode. You may need to figure out how to automatically wake your computer when you need to run the code. Commented Feb 17, 2020 at 14:45

2 Answers 2

1

Yes you can easily do that with Python and Selenium. You can also run it when your computer is in sleep mode, you can use Task Scheduler for that and set up a task that will wake your computer up and run your script and you wont even need to login (I'm assuming you use Windows here).

However, selenium scripts are as robust as you make them, and as @tjallo mentioned if there is an API available, its better to use that route instead. You can actually open the browser windows and open the dev console and look at the Network tab when you click on buttons to enable/disable certain features and see what requests are made, and then try to make same requests with the requests module in Python.

If you are interested exploring the topic of Selenium & Webdriver, I have an entire playlist which explains Selenium concepts from beginner to senior and you can find it here: https://www.youtube.com/playlist?list=PLK7KNOA7vbPOK1Ih3SXyaM1VnWut5Tn17

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

Comments

0

Which home security system are you using? Maybe it has some built in API functionality, which would be (in my opinion) much easier to set up and maintain then some "click script".

If you want to use the second way; maybe look into AutoHotKey (uses Lua instead of python though). Which is great for this kind of stuff.

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.