Program form Submit

I want to clear the contents of a web page. Content is created after the form on this site has been completed and submitted.

I read about how to clear the final result / web page - but how do I programmatically submit the form?

I use python and read that I might need to get the original web page with the form, parse it, get the form parameters, and then do X?

Can someone point me in the right direction?

+2
source share
4 answers

you will need to generate an HTTP request containing the data for the form.

The form will look something like this:

<form action="submit.php" method="POST"> ... </form>

, URL- - www.example.com/submit.php, POST.

, :

<input type="text" name="itemnumber"> ... </input>

= , URL-, URL-, www.example.com/submit.php?itemnumber=5234&otherinput=othervalue .....   GET. POST .

</motivation>

S.Lott : P

+2

python, , :

  • -, , ( "" "" ).

html

  1. urllib2 . , "urlencode", "quote" urllib URL- post. .
+2

- options-for-html-scraping - , Python .

Beautiful Soup - Python HTML/XML-, , . :

  • , . , , . , .
  • Beautiful Soup Pythonic , : , . .
  • Beautiful Soup Unicode UTF-8. , , Beautiful Soup . .

, 12 2008 .

+2

javascript. :

<form name='myform' ...

javascript:

<script language="JavaScript">
function submitform()
{
document.myform.submit();
}
</script> 

You can use the "onClick" attribute of links or buttons to call this code. To automatically activate it when the page loads, use the "onLoad" attribute of the element:

<body onLoad="submitform()" ...>
-1
source

Source: https://habr.com/ru/post/1703596/


All Articles