SendKeys Python module

Tedious copy and pasting to make sure the right amount of tabs was pressed to get to a certain link

Tedious copy and pasting to make sure the right amount of tabs was pressed to select a certain link on a webpage.

A few posts ago, I mentioned that I had been tasked with a script that would automate web browsing to a website. I felt, after doing a little bit of research, that the SendKeys module was best suited for the job. The only problem I encountered was when entering the same key command over and over again became extremely tedious as you can see on the right.

The script would load up a webpage, unfortunately using Internet Explorer, accept a security certificate, type in log in details, open a certain page and then activate an online platform that is used by the company I work for. With this script running on another PC to the one it was developed on, I needed to use another module, Py2Exe, to convert the .py file into an executable file.

Despite the length of the script and the repetitive nature of the commands, the script works absolutely perfectly. The pauses need to be planned in advance – especially when loading an application such as Internet Explorer. I obviously will not be posting the script I built due to the fact it does include an internal IP address of a company’s SNMP probe and log in details but I thoroughly recommend the SendKeys module for any automated tasks you encounter.

If you know of a better way in which automated web browsing can be achieved, I am extremely happy to hear any ideas you may have =)



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: