Understanding How to Run Selenium Using Python Scripts from HTML Buttons

Asked 2 years ago, Updated 2 years ago, 107 views

You have created a script to log in to a specific site with Python+Selenium.
I want to run this Python by pressing the button from the page I created with HTML using Brython, but it doesn't work.Without Selenium, I was able to create HTML+Brython+Python that says Hello when I press the button from my browser, but
from selenium import webdriver Simply add a line to the and it won't work.I looked it up and found that Brython is an emulator for JavaScript, so Selenium can't move.Is there a solution to this?

Any software is fine as long as you can run Selenium from the HTML button and log in to the website.
Another solution I'm thinking about now is to use Tomcat as servlet or JSP, but since I'm not a web programmer, I've never been able to understand words such as front end and back end vaguely.
Thank you for your cooperation.

Environment
·Windows 10
·Selenium
·Brython
·Python 3.7

python selenium

2022-09-30 21:40

1 Answers

In this case,

You have created a script to log in to a specific site with Python+Selenium.

So when I commented on the proposal to utilize it, the respondents solved it on their own, so I will summarize it in the form of an answer.

It seems to have worked well by running a script to log in to the specific site above by returning the view (HTML) with Flask and submitting a request to Flask with a button click, and returning success oracle to the front desk.

The same configuration is possible with non-flask web frameworks (such as Django) and the http module, but Flask is simple and easy to create, so it's a good decision.


2022-09-30 21:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.