I currently have some ad-hoc scripts I run using Selenium to automate browser tasks with sites that do not have an API.
I wish to move this to trigger-based running.
One possible way is do this is to build in these triggers to the scripts, so every x min/seconds, it will check and run if necessary. I have a spare computer that will have this constantly running, but I would prefer to not do it this way.
Is there any way to integrate Selenium and Zapier or complete a similar task by using Zapier triggers?
The script is written in Python.
If you are having windows system you can use Task scheduler. If you are having Linux you can use crontab to schedule tasks.
Assuming you may have windows, You can create .bat file to trigger your selenium (say mytask.bat). Execute the mytask.bat using scheduler.
Start->Control Panel->System and Security->Administrative Tools->Task Scheduler
Action->Create Basic Task->Type a name and Click Next
Follow through the wizard as screen shot given below.
Related
Is it possible to run a python script from GoogleSheets(GS)?
The idea is that I press a button in GS and the python script runs.
I found some older posts about this, like the idea to run it from Google Cloud, but maybe there is a simpler solution in the meantime?
Your Python script will have to be run from the cloud. See URL Fetch Service.
So far when dealing with web scraping projects, I've used GAppsScript, meaning that I can easily trigger the script to be run once a day.
Is there an equivalent service when dealing with python scripts? I have a RaspberryPi, so I guess I can keep it on 24/7 and use cronjobs to trigger the script daily. But that seems rather wasteful, since I'm talking about a few small scripts that take only a few seconds to run.
Is there any service that allows me to trigger a python script once a day? (without a need to keep a local machine on 24/7) The simpler the solution the better, wouldn't want to overengineer such a basic use case if a ready-made system already exists.
The only service I've found so far to do this with is WayScript and here's a python example running in the cloud. The free tier that should be enough for most simple/hobby-tier usecases.
I have a scheduled task (python script) in Windows Task Scheduler that checks a specific email every morning and download the attachment. I have been using this task for about a month it never broke. But today I found that the task can't establish connection to Outlook with win32com.client. When the task runs, it will bring up the command line and then turned off automatically and nothing really runs. It works well if I directly run the python script inside the command line though.
Below is the line where the python script stuck if running in task scheduler.
outlook = win32.Dispatch("Outlook.Application").GetNamespace("MAPI")
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.
Read more about that in the Considerations for server-side Automation of Office article.
As a workaround, you are free to use a low-level API on which Outlook is based on - Extended MAPI or any other third-party wrappers around this API such as Redemption. Also you may consider using EWS if you deal with Exchange only, see Start using web services in Exchange for more information.
It was solved by unclicking "with highest privilege" in task scheduler. Also, I added a chunk of code in front of my python script so that it clears the python temp folder every time of running.
I have .py selenium scripts, I want to schedule the scrips to run daily at specific time.How can i do that ? windows platform
I suggest you see something like APScheduler
Why not use a CI mechanism like Jenkins or Travis CI? These CI tools will give you a perfect mechanism of running your tests, specifically on a specific time or minute of day.
This post talks about scheduling in detail - Jenkins Scheduling.
Once you've scheduled your tests, you can check them manually or just configure them to send you emails once the build is run for the day.
I am currently trying to write a script to automate the ATTO disk benchmark GUI. I can use the script to successfully locate images in the GUI, but I can not get any clicks generated by the script to register in the application. I have modified the script to test if I could use the PyAutoGUI package to click things in other applications, and have been able to successfully click things in other applications. Has anyone else had this issue with other applications using the PyAutoGUI package, and if so did you ever find any solution to the issue?
Please try to run your script with administrative privileges. If you are using Powershell then run powershell as administrator