gpt4 book ai didi

python-3.x - 名称错误 : name 'By' is not defined (selenium)

转载 作者:行者123 更新时间:2023-12-05 01:56:22 28 4
gpt4 key购买 nike

我在我的 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

显示错误:

from: can't read /var/mail/selenium.webdriver.common

最佳答案

改用这一行:

from selenium.webdriver.common.by import By

关于python-3.x - 名称错误 : name 'By' is not defined (selenium),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69878390/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com