simulating user on a web page

This is the place for queries that don't fit in any of the other categories.

simulating user on a web page

Postby mnutz » Mon May 19, 2014 1:12 am

Hi all,

Our work has a web based time system.

We login, click "Complete Timesheet" which shows the time sheet for the day, the click on "log time" that loads another page.

We then manually enter the information.

it takes 3-5 mins a day, and I work 3 shift types and always have the exact same input.

I've used autohotkey to record a macro for entering the data and it can do it in about 30-60 seconds, but they keep changing the layout.

I want to use python to interact with the document directly so despite the layout it will still work. Is it possible?

I don't want a solution or code writing, just suggestions on things i should read up on, online resources etc or modules/frameworks.

I've written a few little web scrapers before for pulling basic info from xml feeds but i'm rusty and getting back up to speed now.

Thanks in advance for any advice :D
mnutz
 
Posts: 10
Joined: Sun Nov 17, 2013 8:11 am

Re: simulating user on a web page

Postby Kebap » Mon May 19, 2014 9:49 am

Hi mnutz! Maybe have a look at python module "mechanize". I heard, it can simulate a browsing user, easily handling things like logging in to a site, clicking buttons, entering text, handling cookies, etc. These things I found quite hard to do, last time I tried without mechanize.
Learn: How To Ask Questions The Smart Way
Join the #python-forum IRC channel on irc.freenode.net and chat with uns directly!
Kebap
 
Posts: 396
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Re: simulating user on a web page

Postby mnutz » Mon May 19, 2014 2:11 pm

Hey, thanks for the suggestion. Gives me somewhere to start :D
mnutz
 
Posts: 10
Joined: Sun Nov 17, 2013 8:11 am

Re: simulating user on a web page

Postby micseydel » Mon May 19, 2014 10:43 pm

mechanize is probably what you want, but selenium might be as well (if Javascript is a pain). You might also want to look into a browser extension for saving forms. You could also use your browser's developer options to see if an AJAX request is being made, capture that, and simply send it as necessary. You might need to use mechanize to get cookies before hitting the AJAX url though.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1369
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Re: simulating user on a web page

Postby mnutz » Mon May 19, 2014 11:04 pm

Thanks, looks like I've a bit of reading to do :D
mnutz
 
Posts: 10
Joined: Sun Nov 17, 2013 8:11 am


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 3 guests