How to interact with webpage button?

12 Ansichten (letzte 30 Tage)
b
b am 13 Okt. 2022
Beantwortet: Rahul am 24 Jun. 2025
A webpage has quiz questions with 4 answers. Unless the user presses 'Send' button (with or without selecting any option for any question), the answers are not revealed.
The answers are revealed, once the user presses the 'send' button. This then appears in page source.
The answer url cannot be read directly by urlread because it doesn't show the answers.
How to simulate the pressing of this 'send' button so that urlread can read the page source of the answer-page?

Antworten (1)

Rahul
Rahul am 24 Jun. 2025
Hi @b,
I understand that you wish to implement the functionality of interacting with a button on a webpage using MATLAB. There are a few things to keep in mind.
  • If the webpage is implementing just a POST/GET request in the background after the button is pressed, the you might be able to use 'webwrite' to invoke simple POST requests to obtain the static html which would come after the button press.
  • However, if the webpage is based on React/Angular or uses Javascript for DOM Manipulation, then MATLAB alone would not be able to implement the functionality as it does not directly deal with JavaScript.
  • In that case, consider using selenium using python to interact with the webpage and simulate the button click and execute Javascript for DOM Manipulation. Then 'pyenv' function can be used in MATLAB to obtain the html from the python executable file, which can be used to demostrate data iun MATLAB.
The following MathWorks documentations can be referred:
Thanks.

Kategorien

Mehr zu Just for fun finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by