Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Selenium get_page_source function

by Illuminatus (Curate)
on Aug 07, 2013 at 15:51 UTC ( #1048370=note: print w/ replies, xml ) Need Help??


in reply to Selenium get_page_source function

caveat: I have never used Selenium, nor the module you mention

  1. Correct me if I'm wrong, but if you 'get_page_source', it's essentially going to be HTML. Perhaps the zip file will be embedded in it (although I doubt it), but it's going to have formatting around it. Have you looked at the file after you copied it? Checked the size?
  2. Is there some reason why you chose Selenium to do this? It's more of a test/validation tool.
  3. Did you look at WWW::Mechanize? The 'get' method should give you the file the way you want it

fnord


Comment on Re: Selenium get_page_source function
Re^2: Selenium get_page_source function
by ragilla (Initiate) on Aug 08, 2013 at 03:08 UTC

    Yes Caveat, get_page_source it returns html page , but as the downloading file is zip file, when you open the file it will not in html characters, some junk, Yes the file have size, do we need to use encode/decoding so that file will formed correct without damaging

      Your code example shows it writing the return from get_page_source to the file that you're renaming to ".zip". I wasn't sure if some additional transformation was necessary to remove the html 'wrapper'. These are the things I would do (some of which you may have already done):
      1. Download the zip file manually and verify that you can unzip it
      2. If you're on a *nix system, run 'sum file.zip' and 'file file.zip' on the file and keep the results
      3. Verfiy the 'content-encoding:' is what you expect
      4. Once you use your script to download, use 'sum' and 'file' on the result(s) to look for differences

      fnord

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1048370]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2014-12-25 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (163 votes), past polls