javascript - Issue trying to convert Python with Selenium module to JavaScript using Brython
问题描述
I am currently trying to code a Chrome extension that should run a program in the background, however I have written this code in Python as I am more familiar with this language than JavaScript. Since obviously Chrome extension only works with JavaScript, I am trying to compile my Python code using Brython. My issue is that I have used the Selenium module within my Python code and Brython is having issues detecting it. I've tried including:
<body onload="brython({debug:1, pythonpath:['c:\\users\\anastasialauri\\appdata\\local\\programs\\python\\python39\\lib\\site-packages']})">
however an error: Not allowed to load local resource shows up on the html page.
Below is my html code trying to test running the Python script. I would appreciate any help please!
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="brython.js"></script>
<script type="text/javascript" src="brython_stdlib.js"></script>
</head>
<body onload="brython({debug:1, pythonpath:['c:\\users\\anastasia lauri\\appdata\\local\\programs\\python\\python39\\lib\\site-packages']})">
<script type="text/python" src="Applet.py"></script>
</body>
</html>```
解决方案
推荐阅读
- reactjs - 无法启动 React 简单应用程序我得到错误:元素类型无效:预期为字符串
- python - 在我的代码中,我想添加我的密码数字 + 字符串,例如 1234xyz
- amazon-web-services - 没有 NAT 的私有 VPC 中的 Elastic Beanstalk 应用程序
- python - 在python的产品代码中不将变量传递给函数的最佳方法是什么?
- rest - 如何将用户添加到 SharePoint 用户组
- python - 无法填写话语模板 - Rasa Chatbot
- javascript - let 和 const 算作声明语句吗?
- flutter - Flutter bloc:更新状态不会刷新我由 bloc 管理的视图
- c++ - 为什么这个级别顺序遍历在 O(n) 时间内运行?
- jquery - 在 Safari 上获取 iframe 高度