[Tutor] Performance Issue
stephen.m.smith at comcast.net
Wed Oct 17 17:25:17 EDT 2018
I have written a screen scraping program that watches a clock (on the app's
server) and at 7:00:00 AM dashes to make a reservation on line. It works
fine. However, i have spent time trying to improve its performance. I am
using selenium, with chrome driver.
Here is what i have learned. I have tried various methods to find (by
link_text, by_xpath, etc.) and click on the element in question (shown
below). When i find the element with no click, the find process takes about
.02 seconds. When i find it with a click (i need to select the element and
move to the next iframe) it takes over a second. I get these same results no
matter which find_element_by variation i use and i get the same times in
headless or normal mode.
Here is my theory - finding the element is relatively simple in the html
already loaded into my machine - hence .02 seconds. However, when i click on
the element, processing goes out to the server which does some stuff and i
get a new iframe displayed, all of which takes time. So i have sort of
concluded that perhaps I can't take a big chunk of that time out (literally
the same statement without the click option takes 2% of the time), but am
hoping perhaps someone has another thought. I had thought maybe i could jump
to the second ifame locally, but can't see a way to do this. I also have
considered something other than selenium, but since i think the problem lies
on the server side, not sure it is worth the time.
Thanks in advance for any ideas.
The program is quite large, but here is the relevant section:
# Back from NAP - REALLY CLOSE to 7:00 AM select the date desired and
go to the next page (really iframe) - using prepared xpath
self.queue.put("- (" + thread + ") Attempted date selection too
early? " + str(datetime.datetime.now()\
+ datetime.timedelta(seconds =
Here is the relevant html (in this case I have copied the html for the 31st
of the month, but all dates look the same which is why
find_element_by_link_text [with day_to_book = 31) is easy to use. Again, my
code works fine - I am trying to see if there is a way to improve
performance with some trick I can't come up with.
More information about the Tutor