当前位置:网站首页>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")边栏推荐
- 问题1:给你1-10的列表,实现列表输出,单数在左边,双数在右边。
- Unity2D 自定义Scriptable Tiles的理解与使用(四)——开始着手构建一个基于Tile类的自定义tile(下)
- [shell basics] determine whether the directory is empty
- pom文件成橘红色未加载的解决方案
- Pytest电商项目实战(上)
- ClickHouse:设置远程连接
- Safety 20220722
- MATLAB/Simulink & & STM32CubeMX tool chain completes model-based design development (MBD) (three)
- A brief introduction to the CheckboxListTile component of the basic components of Flutter
- Daily practice of LeetCode - 138. Copy a linked list with random pointers
猜你喜欢

Reinforcement learning: from entry to pit to shit

$attrs/$listeners
![[C language] General method of base conversion](/img/28/954af5f47a79ff02d3cc0792ac8586.jpg)
[C language] General method of base conversion

手把手实现图片预览插件(三)

【小土堆补充】Pytorch学习笔记_Anaconda虚拟环境使用

SIP Protocol Standard and Implementation Mechanism
![[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

Knowledge Distillation 7: Detailed Explanation of Knowledge Distillation Code

The idea project obviously has dependencies, but the file is not displayed, Cannot resolve symbol 'XXX'
![[C language] General method of expression evaluation](/img/59/cf43b7dd16c203b4f31c1591615955.jpg)
[C language] General method of expression evaluation
随机推荐
open failed: EACCES (Permission denied)
浅识Flutter 基本组件之showDatePicker方法
$attrs/$listeners
【AUTOSAR-RTE】-4-Port and Interface and Data Type
binom二项分布,
已解决(最新版selenium框架元素定位报错)NameError: name ‘By‘ is not defined
IIR filter and FIR filter
MySQL 8.0.30 GA
BUG destroyer!!Practical debugging skills are super comprehensive
[AUTOSAR-RTE]-5-Explicit (explicit) and Implicit (implicit) Sender-Receiver communication
[Swift]自定义点击APP图标弹出的快捷方式
Why SocialFi achievement Web3 decentralized social in the future
Learning DAVID Database (1)
The use of beforeDestroy and destroyed
Notes on the establishment of the company's official website (6): The public security record of the domain name is carried out and the record number is displayed at the bottom of the web page
安全20220715
安全20220709
The third is the code to achieve
Exsl file preview, word file preview web page method
three.js 制作3D相册