Why urllib.urlopen.read() does not correspond to source code?

前端 未结 5 686
说谎
说谎 2021-01-11 14:02

I\'m trying to fetch the following webpage:

import urllib
urllib.urlopen(\"http://www.gallimard-jeunesse.fr/searchjeunesse/advanced/(order)/author?catalog[0]         


        
5条回答
  •  无人及你
    2021-01-11 14:39

    you can use python Selenium to solved your issue. Here is a example code have a look.

    from selenium import webdriverr
    url = "http://www.gallimard-jeunesse.fr/searchjeunesse/advanced/(order)/author?catalog[0]=1&SearchAction=1"
    browser = webdriver.Firefox()
    browser.get(url)
    sleep(10)
    all_body_id_html =  browser.find_element_by_id('body') # you can also get all html
    

    Then due your rest of work according to your choice some more example with browser instance

    def login(user='ssdf', password="cisin123"):
    content = browser.find_element_by_id('content')
    content.find_element_by_xpath('.//tbody/tr[2]//input[contains(@class,"textbox")]').send_keys(user)
    content.find_element_by_xpath('.//tbody/tr[3]//input[contains(@class,"textbox")]').send_keys(password)
    content.find_element_by_css_selector(".button").click()
    

提交回复
热议问题