Skip to content Skip to sidebar Skip to footer

Scrape An Ajax Form With .submit() With Python And Selenium

I am trying to get the link from a web page. The web page sends the request using javascript, then the server sends a response which goes directly to download a PDF. This new PDF i

Solution 1:

I found the answer. The request sends a POST form. Therefore, we have to extract the header contents and their parameters. When you know the parameters the form sends, you can use the request to get back the link to your console.

response = requests.get(url, params={'key1': 'value1', 'key2': 'value2'})
print (response.url)

This question solves additionally this question: Capture AJAX response with selenium python

Cheers!

Post a Comment for "Scrape An Ajax Form With .submit() With Python And Selenium"