我在python代码中得到了这个错误:
Traceback (most recent call last):
File "/Users/user/Batch-image-compression/compress_pic.py", line 54, in <module>
**input_box = driver.find_element(By.XPATH,'//input[@class="_2zg9i"]')**
NameError: name 'By' is not defined
在我的脚本中,我有:
from selenium.webdriver.common import By
显示错误:
来自:无法读取/var/mail/selemeum.webdriver.comon
改为使用此行:
from selenium.webdriver.common.by import By