当前位置:网站首页>Solved (the latest version of selenium framework element positioning error) NameError: name 'By' is not defined
Solved (the latest version of selenium framework element positioning error) NameError: name 'By' is not defined
2022-07-31 04:12:00 【no envy】
Resolved (the latest version of selenium framework element positioning error) NameError: name 'By' is not defined
Article table of contents
Error code
A question raised by a small partner of a fan group, an error is reported when operating selenium positioning elements:

Error code:
Error message: NameError: name 'By' is not defined
Error translation
Translation of error content:
Name error: Undefined name "By"
Reason for error
Reason for the error: The latest syntax for element positioning of the selenium framework needs to import the By module, and the code that he does not copy is not imported
Workaround
Import the By module at the beginning:
from selenium.webdriver.common.by import ByComplete code:
from selenium.webdriver.common.by import By# get the first elementbrowser.find_element(by=By.CLASS_NAME, value="element")# Get multiple elementsbrowser.find_elements(by=By.CLASS_NAME, value="element")边栏推荐
- $attrs/$listeners
- Mysql 45 study notes (twenty-four) MYSQL master-slave consistency
- 问题1:给你1-10的列表,实现列表输出,单数在左边,双数在右边。
- [C language] General method of base conversion
- (8) Math class, Arrays class, System class, Biglnteger and BigDecimal classes, date class
- Win10 CUDA CUDNN installation configuration (torch paddlepaddle)
- (六)枚举、注解
- RESTful api接口设计规范
- binom二项分布,
- Component pass value provide/inject
猜你喜欢
![[Swift]自定义点击APP图标弹出的快捷方式](/img/d4/84b237995fc3d3700916eb57f6670d.png)
[Swift]自定义点击APP图标弹出的快捷方式

The third is the code to achieve

5. How does the SAP ABAP OData service support the $filter operation

(4) Recursion, variable parameters, access modifiers, understanding main method, code block

【C语言进阶】文件操作(一)

binom二项分布,

Exsl file preview, word file preview web page method

endian mode
![[Swift] Customize the shortcut that pops up by clicking the APP icon](/img/d4/84b237995fc3d3700916eb57f6670d.png)
[Swift] Customize the shortcut that pops up by clicking the APP icon

LocalDate addition and subtraction operations and comparison size
随机推荐
Why SocialFi achievement Web3 decentralized social in the future
[Paper reading] Mastering the game of Go with deep neural networks and tree search
(tree) Last Common Ancestor (LCA)
问题1:给你1-10的列表,实现列表输出,单数在左边,双数在右边。
Redis uses LIST to cache the latest comments
log level and print log note
"A daily practice, happy water problem" 1331. Array serial number conversion
LocalDate addition and subtraction operations and comparison size
【小土堆补充】Pytorch学习笔记_Anaconda虚拟环境使用
C语言表白代码?
Win10 CUDA CUDNN installation configuration (torch paddlepaddle)
Why don't you programmers make a living off your own projects?And have to work for someone else?
Redis counts new and retained users
MATLAB/Simulink&&STM32CubeMX工具链完成基于模型的设计开发(MBD)(三)
mysql基础知识(二)
beforeDestroy与destroyed的使用
ENSP,划分VLAN、静态路由,三层交换机综合配置
type_traits metaprogramming library learning
Mysql 45 study notes (twenty-five) MYSQL guarantees high availability
从滴滴罚款后数据治理思考