[Tutor] Py/selenium bindings

bruce badouglas at gmail.com
Sun Feb 28 22:45:33 EST 2016


Hi.

This might be a bit beyond the group, but I figured no harm/no foul.

I'm looking to access a site that's generated via javascript. The jscript
of the site is invoked via the browser, generating the displayed content.

I'm testing using py/selenium bindings as docs indicate that the
py/selenium/PhantomJS browser (headless) combination should invoke the
jscript, and result in the required content.

However, I can't seem to generte anything other than the initial encrypted
page/content.

Any thoughts/comments would be useful.

The test script is:

#!/usr/bin/python
#-------------------------------------------------------------
#
#    FileName:
#        udel_sel.py
#
#
#-------------------------------------------------------------

#test python script
import subprocess
import re
import libxml2dom
import urllib
import urllib2
import sys, string
import time
import os
import os.path
from hashlib import sha1
from libxml2dom import Node
from libxml2dom import NodeList
import hashlib
import pycurl
import StringIO
import uuid
import simplejson
import copy
from selenium import webdriver



#----------------------------------------

if __name__ == "__main__":
# main app


  url="
http://udel.bncollege.com/webapp/wcs/stores/servlet/TBListView?storeId=37554&termMapping=Y&catalogId=10001&langId=-1&courseXml=%3C%3Fxml+version%3D%221.0%22%3F%3E%3Ctextbookorder%3E%3Cschool+id%3D%22289%22+%2F%3E%3Ccourses%3E%3Ccourse+num%3D%22200%22+dept%3D%22ACCT%22+sect%3D%22010%22+term%3D%222163%22%2F%3E%3C%2Fcourses%3E%3C%2Ftextbookorder%3E
"


  driver = webdriver.PhantomJS()
  driver.get(url)
  xx=driver.page_source

  print xx

  sys.exit()

---------------------------------------------------------------------------


More information about the Tutor mailing list