How to use selenium with pyscript

Hello, I am working on a project with selenium and I get the following error when I try to import the libraries:

this is the file .py

from selenium import webdriver
driver =webdriver.Chrome(executable_path = r"C:\Users\hel\OneDrive \Documentos\DOCUMENTOS ANALISTA\automatizacion\pyScript\prueba\chromedriver.exe")

this is the file html


  <link rel="stylesheet" href="" />

  <script defer src=""></script>

<h1>Let's plot random numbers</h1>

<div id="plot"></div>

<py-script src="./">


Selenium controls the browser from the outside. Those feature will not work inside the browser sandbox.

Note: the reason for the error message is that you did not include the package in <py-env> to download

> <py-env>
>   - selenium
> </py-env>

However that will not allow you to use selenium in Pyscript.

1 Like

hello, try to call it that way but I get the same error, my main objective is to call or run a script that I have saved on my local disk through a button and that .py script in turn imports some selenium libraries:
I want that when the blue button is pressed, I execute the following script

Thank you very much for your answer

As my answer mentioned, you cannot use Selenium inside the browser. Your program must run outside the browser to control the browser.

If that is very clear to me, what I would like to know is how I can do to execute it from the outside so that when the start button is clicked, the execution is on another screen and a different process

Selenium has nothing to do with PyScript. You are on the wrong forum.