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
data.py
from selenium import webdriver
driver =webdriver.Chrome(executable_path = r"C:\Users\hel\OneDrive \Documentos\DOCUMENTOS ANALISTA\automatizacion\pyScript\prueba\chromedriver.exe")
driver.get(“http://www.python.org”)
driver.close()
this is the file html
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<h1>Let's plot random numbers</h1>
<div id="plot"></div>
<py-script src="./data.py">
</py-script>
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 radicacion.py
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.