Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
328 views
in Technique[技术] by (71.8m points)

python - 无法解决在python中的Selenium Webdriver中导入密钥的错误(unable to resolve the error for importing keys in selenium webdriver in python)

I am new to python and I am writing a code for fb automation using selenium webdriver.

(我是python的新手,我正在使用selenium webdriver编写fb自动化代码。)

I wrote the following command:

(我写了以下命令:)

driver.find_element_by_class_name('_1frb').send_keys(keys.ENTER)

and also included the library:

(并且还包括库:)

from selenium.webdriver.common.keys import Keys

it shows the following error:

(它显示以下错误:)

NameError: name 'keys' is not defined

Why am I getting this error?

(为什么会出现此错误?)

What changes can I make to resolve this?

(我可以进行哪些更改来解决此问题?)

  ask by Pragya translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Python是区分大小写的编程语言,因此您应将Keys.ENTER与大写K一起使用。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...