mercredi 22 avril 2015

Automate acceptance of license terms in order to download file

I need to download a file while I have to accept license agreement.

For example from

http://ift.tt/1sbbn32

I would like to download

 Linux x86  146.84 MB     jdk-8u40-linux-i586.rpm

I though about something like:

browser = spynner.Browser()
url = "http://ift.tt/1sbbn32"
browser.load(url)
browser.runjs("acceptAgreement(window.self, 'sjre-8u40-oth-JPR');")
file = browser.download("http://ift.tt/1IJQcix")
if file == None or file == "":
    print("Wrong")
else:
    data = file.read()
    with open("code3.rpm", "wb") as code:
        code.write(data)

but it always says "Wrong" so there is probably nothing in file variable.

Can somone please give me a hint?




Aucun commentaire:

Enregistrer un commentaire