当前位置:网站首页>Selenium interview question sharing
Selenium interview question sharing
2022-06-12 09:13:00 【Software testing Lao Mo】
Catalog
1、selenium How to determine the existence of an element in ?
2、selenium in hidden Or is it display = none Whether the element of can be positioned to ?
4、 Is it necessary to connect to the database for data verification when testing automatically ?
5、id,name,clas,xpath, css selector These attributes , Which one do you prefer the most , Why? ?
6、 How to locate dynamically loaded elements on a page ?
7、 How to locate elements with dynamic attributes ?
8、selenium What is the principle of ?
9、webdriver What is your agreement ?
10、 Which is used when starting the browser webdriver agreement ?
11、 What is? page object Design patterns ?
1、selenium How to determine the existence of an element in ?
selenium There is no native method to determine whether an element exists in , In general, we can locate elements + Judge the way of exception capture .
# Determine whether an element exists
try:dr.find_element_by_id('none')except NoSuchElementException:print 'element does not exist'
2、selenium in hidden Or is it display = none Whether the element of can be positioned to ?
Can not be ,selenium Cannot locate invisible elements .display=none The element of is actually invisible .
3、selenium How to ensure the success rate of operation elements ? That is to say, how to ensure that the elements I click on must be clickable ?
- When the network speed is not good , Use the appropriate waiting time
- The clicked element must occupy a certain space , because selenium By default, it will go to the center point of this element , Elements that don't take up space can't calculate the center point ;
- The clicked element cannot be obscured by other elements ;
- The clicked element cannot be in the viewport outside , That is, if the element must be visible or made visible by scroll bar operation ;
- Determine whether an element can be clicked
How to improve selenium The speed of script execution ?
- Use a higher configured computer and choose a faster network environment
- Use more efficient languages , such as java The execution speed is faster than python
- Optimize the code
- Don't blindly add sleep, Try to use explicit wait
- about firefox, Consider using test specific profile, Because every time you start the browser firefox Will create 1 A new one profile, For this new profile, All static resources are downloaded directly from the server , Instead of loading from the cache , This leads to the problem that the running speed of use cases is particularly slow when the network is bad
- chrome The browser and safari The execution speed of the browser seems to be the fastest
- Consider distributed execution or using selenium grid
Use cases are often unstable in the running process , That is to say, this time we can pass , I can't pass next time , How to improve the stability of use cases ?
- Test exclusive profile, Try to cache static resources
- Try to use explicit wait
- Try to use a test specific environment , Avoid other types of testing at the same time , Interfere with data
What is the execution strategy for your automation use cases ?
- Execute... Daily : For example, execute on the trunk every night
- Cycle execution : every other 2 Execute every 1 / 2 of the development hours
- Dynamic execution : Execute every time code is submitted
4、 Is it necessary to connect to the database for data verification when testing automatically ?
In general, you don't need , Because this is what the unit test layer does , In the automation test layer, try not to pay off the debt for the work that the unit test layer has not done .
5、id,name,clas,xpath, css selector These attributes , Which one do you prefer the most , Why? ?
xpath and css Most flexible , So the other answers are not perfect .
6、 How to locate dynamically loaded elements on a page ?
Explicit waiting
7、 How to locate elements with dynamic attributes ?
Find out the law of dynamic change of attributes , Then generate dynamic attributes according to the context .
After clicking on the link ,selenium Whether it will automatically wait for the page to load ?java binding After clicking the link, it will automatically wait for the page to load .
8、selenium What is the principle of ?
selenium The principle of involves 3 Parts of , Namely
- browser
- driver: We usually download driver
- client: That's the code we wrote
client In fact, I don't know how the browser works , however driver know , stay selenium After the start ,driver In fact, it acts as a server , Follow client Communicate with the browser ,client according to webdriver The protocol sends a request to driver,driver Resolve request , And perform corresponding operations on the browser , And return the execution result to client. This is it. selenium How it works .
9、webdriver What is your agreement ?
client And driver Agreement between , No matter what client It's using java Implementation or c# Realization , Just pass this Agreement ,client Can accurately tell drier What it does and how it does it .
webdriver The agreement itself is http agreement , Data transmission uses json. Here you are webdriver All aspects of the agreement endpoint, You can see this at a glance endpoints covers selenium All functions of .
10、 Which is used when starting the browser webdriver agreement ?
New Session, If created successfully , return sessionId and capabilities.
11、 What is? page object Design patterns ?
To put it simply, use class To represent the page under test . stay class Define the elements on the page and some methods specific to the page .
边栏推荐
- MySQL learning record - II. MySQL create table command
- Four steps for sending rockertmq producer messages
- day5-x
- (15) Tweenrunner
- Binary tree calculation problem
- The database doesn't know what went wrong
- 目标识别、检测和 6D 姿态估算源码与方案(最先进的方法和数据集)
- Flink passes in custom parameters or profiles
- 128. 最長連續序列-哈希錶
- Basic exercise letter graphics
猜你喜欢

解压缩zip文件的工具类
功能测试面试常见的技术问题,总结好了你不看?

node示例后台搭建

List < string > sort
Cas d'essai et spécification de description des bogues référence

Detailed explanation of iSCSI (V) -- actual operation of iSCSI client configuration

Use NVM to dynamically adjust the nodejs version to solve the problem that the project cannot be run and packaged because the node version is too high or too low
![[character set 8] char8_ t、char16_ t、char32_ t、wchar、char](/img/ef/e57fb345b36c84d3585fca0568b0ee.png)
[character set 8] char8_ t、char16_ t、char32_ t、wchar、char

Introduction to applet cloud development -- questionnaire evaluation applet practice (7)

Distributed task scheduling
随机推荐
解决当打开Unity时 提示项目已经打开,而自己之前并没有打开过(可能之前异常关闭)的问题
帮助你拿到offer的金融测试面试题
MySQL learning record - II. MySQL create table command
top命令含义
ERROR 1630 (42000): FUNCTION a.avg does not exist. Check the ‘Function Name Parsing and Resolution‘
2022 melting welding and thermal cutting test questions and answers
[character set 6] wide string and multi byte character conversion
Four steps for sending rockertmq producer messages
功能测试面试常见的技术问题,总结好了你不看?
2022 simulated examination platform operation of high voltage electrician work license question bank
Make a simple page with the websql database of HTML5:
After going to the bathroom, I figured out the ES search server
Flink CheckPoint : Exceeded checkpoint tolerable failure threshold
Jupyter notebook sets the default browser to open with an error syntaxerror: (Unicode error) 'UTF-8' codec can't decode byte 0xd4
Es6-- common basic knowledge
机器学习笔记 - 循环神经网络备忘清单
[character set 7] what are the wide character codes and multi byte codes of Chinese characters
mySql学习记录——三、mysql查询语句
Detailed explanation of iSCSI (V) -- actual operation of iSCSI client configuration
測試用例和bug描述規範參考