我试图编写一个简单的Python程序来控制浏览器。但是,当我执行以下操作时,会出现错误。
动作:
我在文件上写了这个:
from selenium import webdriver
class InstaBot():
def __init__(self):
self.driver = webdriver.Chrome()
然后我启动了一个虚拟环境,并在命令行中输入了
python3 -I insta_bot.py
然后
bot = InstaBot()
但是我得到这个错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'InstaBot' is not defined