Dor George
Dor George

Reputation: 101

Python: How to simulate a click using BeautifulSoup

I don't want to use selenium since I dont want to open any browsers.

The button triggers a Javascript method that changes something in the page. I want to simulate a button click so I can get the "output" from it.

Example (not what the button actually do) :

I enter a name such as "John", press the button and it changes "John" to "nhoJ". so I already managed to change the value of the input to John but I have no clue how I could simulate a button click so I can get the output.

Thanks.

Upvotes: 0

Views: 7676

Answers (2)

Amin Etesamian
Amin Etesamian

Reputation: 3699

BeautifulSoup is an HtmlParser you can't do such thing. Buf if that button calls an API, you could make a request to that api and I guess that would simulate clicking the button.

Upvotes: 1

Bryan Oakley
Bryan Oakley

Reputation: 386372

You can't do what you want. Beautiful soup is a text processor which has no way to run JavaScript.

Upvotes: 4

Related Questions