如何将Python Selenium与Electron JS应用程序连接
我正在构建一个简单的自动化应用程序,它将使用Electron JS实现良好的GUI,然后使用Python Selenium实现任务的自动化 我刚刚开始尝试运行electron JS应用程序,它显示没有名为selenium的模块 这是我的python(demo.py) 当我运行应用程序时,我在控制台中收到此错误如何将Python Selenium与Electron JS应用程序连接,python,python-3.x,selenium,selenium-webdriver,browser-automation,Python,Python 3.x,Selenium,Selenium Webdriver,Browser Automation,我正在构建一个简单的自动化应用程序,它将使用Electron JS实现良好的GUI,然后使用Python Selenium实现任务的自动化 我刚刚开始尝试运行electron JS应用程序,它显示没有名为selenium的模块 这是我的python(demo.py) 当我运行应用程序时,我在控制台中收到此错误 index.js:12 Uncaught Error: ModuleNotFoundError: No module named 'selenium' at PythonShel
index.js:12 Uncaught Error: ModuleNotFoundError: No module named 'selenium'
at PythonShell.parseError (/Users/rahul/Desktop/justDev/electronBro/hello-world/node_modules/python-shell/index.js:258:21)
at terminateIfNeeded (/Users/rahul/Desktop/justDev/electronBro/hello-world/node_modules/python-shell/index.js:141:32)
at ChildProcess.<anonymous> (/Users/rahul/Desktop/justDev/electronBro/hello-world/node_modules/python-shell/index.js:133:13)
at ChildProcess.emit (events.js:223:5)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
----- Python Traceback -----
File "/Users/rahul/Desktop/justDev/seleniumBro/demo.py", line 3, in <module>
from selenium import webdriver
index.js:12未捕获错误:ModuleNotFoundError:没有名为“selenium”的模块
在PythonShell.parseError(/Users/rahul/Desktop/justDev/electronBro/hello world/node_modules/PythonShell/index.js:258:21)
最终需要(/Users/rahul/Desktop/justDev/electronBro/hello world/node_modules/pythonshell/index.js:141:32)
在这个过程中。(/Users/rahul/Desktop/justDev/electronBro/hello world/node_modules/pythonshell/index.js:133:13)
在ChildProcess.emit(events.js:223:5)
在Process.ChildProcess.\u handle.onexit(内部/child\u Process.js:272:12)
-----Python回溯-----
文件“/Users/rahul/Desktop/justDev/seleniumBro/demo.py”,第3行,在
从selenium导入webdriver
我使用MAC操作系统。这也是新的。请帮助。根据我的观点。您应该使用Node.js,正如pguardio所说,Selenium也可用于Node。FYI,Selenium也可用于Node。否则,您需要以某种方式将python与您的电子应用程序一起分发。@pguardiaro嘿,谢谢您提供的信息。我有两个问题:1:我应该使用节点JS而不是Python?2:我能用Node JS Selenium实现同样的自动化吗?基本上是一样的,但还有更多的工作要做。另一个想法是从electron切换到flask,如果您对Python更熟悉的话,这可能是最好的选择。再次感谢。我对electron和Python都是新手,甚至可以学习Node.Js。我希望这能奏效。
index.js:12 Uncaught Error: ModuleNotFoundError: No module named 'selenium'
at PythonShell.parseError (/Users/rahul/Desktop/justDev/electronBro/hello-world/node_modules/python-shell/index.js:258:21)
at terminateIfNeeded (/Users/rahul/Desktop/justDev/electronBro/hello-world/node_modules/python-shell/index.js:141:32)
at ChildProcess.<anonymous> (/Users/rahul/Desktop/justDev/electronBro/hello-world/node_modules/python-shell/index.js:133:13)
at ChildProcess.emit (events.js:223:5)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
----- Python Traceback -----
File "/Users/rahul/Desktop/justDev/seleniumBro/demo.py", line 3, in <module>
from selenium import webdriver