1

so I've been tasked with coming up with a Python script that checks the load time of pages in our application.. problem is, each page is dynamic.

Here is an example of the pages: Page 1: https://<'sitename'>/<'area_of_site'>/5462174380064768/new-page/?industry=<'some_industrty_here'>

Page 2: https://<'sitename'>/<'another_area_of_site'>/54621743808484848/old-page/?industry=<'some_OTHER_industrty_here'>

And so on... the site has many different areas/url structures so I just want to be able to 'grab' the current url (whatever that is) and use that.

Below is the script I had been using:

 stream = urllib2.urlopen('http://www.google.com')
 start_time = time()
 output = stream.read()
 end_time = time()
 stream.close()

 print "Ping in ms = %r:" % (round(end_time-start_time, 3))

But as you can see, I am unable to use the generic "google.com". I've seen other posts about getting the current url but they all seem to be based on the idea that you know what the url is in advance so those don't really help.

I see there's a 'get current url' in Javascript but I need to be able to do this with Python.

This needs to be a Python script so I'm not sure if I will able to use Selenium calls

Any suggestions?

Thanks!

Deez
  • 11
  • 4
  • What do you mean? Just use string formatting on the URL. – Malik Brahimi Sep 25 '15 at 20:13
  • I should probably add a) I am using python 2.7 and b) I am not a 'developer' - I'm actually fairly new to Python so please elaborate on responses. Thanks – Deez Sep 25 '15 at 21:08
  • I'm not a developer either. I'm in high school. – Malik Brahimi Sep 25 '15 at 22:32
  • What do you mean by "current url"? How do the clients accessing your site know the "current url"? And who generates those urls? – timakro Sep 26 '15 at 07:53
  • By 'Current URL' I mean whatever the loading URL is. Here is an example: step1: Navigate to step 2: click some link and a page loads with the url (Note: the script would have NO idea what the name of the loading page would be in advance)- step 3 - check the load time of the "current url" which is: – Deez Sep 26 '15 at 18:34

0 Answers0