当前位置:网站首页>Selenium - by changing the window size, the width, height and length of different models will be different
Selenium - by changing the window size, the width, height and length of different models will be different
2022-07-03 06:23:00 【wumingxiaoyao】
introduction
I've been in contact with UI test , It involves such a scenario , Change page size , The default prompt of an input box on the verification page will be different . for example : The page width is set to be less than or equal to 1024, A short prompt should be displayed , Greater than 1204 Show long prompt .Case It is passed locally , But everyday Jenkins Running on the Remote VM On , It is completely inconsistent with expectations .1024 The width shows the prompt of growth . Come to the conclusion , Perform tests on different models , Set the same page width , But the expected results are actually inconsistent . This article is to solve this puzzle .
Summary :
- Solve the mystery Selenium Window Size
- Pixels ,PPI The concept of
- The problem is solved
Solve the mystery Selenium Window Size
Usually UI Automation Will Selenium The underlying method is encapsulated , Maybe you set the size in a way similar to the following .
Driver.ResizeWindow(width, height);
among width,height It's all integers , I will list some common display resolution settings . These resolution settings on the display distinguish the number of pixels representing the width and height of the display .
that Selenium The bottom one width and height What unit , Let's continue to dig further .
public void ResizeWindow(int width, int height)
{
_driver.Manage().Window.Size = new Size(width, height);
}
Window.Size yes Size structure
Size Structure :
System.Drawing Provide right GDI+ Access to graphic functions . among width and height It represents the number of pixels .
Point Structure : So pass Selenium Set the page size to be consistent with the resolution set on the display , Both indicate the number of pixels displayed in width and height .
Pixels ,PPI The concept of
that , What is the relationship between the number of pixels and the width and height we can perceive . We need to understand a few concepts .
Pixels
Pixel is the abbreviation of image element , It is the smallest unit of all digital images . We use it 100% Or lower zoom level to view the image, you can't see the pixels . When you enlarge a picture , We can see a pile of small squares . These squares are pixels .
PPI
PPI (Pixels Per Inch) Is the pixel density , The number of pixels per unit length on the screen : This unit length is defined as "1 Inch ". such as 1 There are two pixels in inches ,PPI Namely 2.1 Within inches 10 Pixels ,PPI Namely 10. therefore PPI The higher the value , That is to say, the higher the density of the display screen, the higher the image density . Of course , The higher the density of the display , The higher the fidelity , The more expensive the monitor is .
Refer to the previous picture to explain the connection of several concepts .
The popular science 2K 4K
We often hear movie theater points 2K, 4K Screen concept .
2K Resolution refers to a level of screen resolution , Refers to the horizontal pixel of the screen reaching 2000 above . It is the mainstream projection resolution of domestic digital cinema .2K There are many kinds of resolutions , The most common cinemas 2K Refer to 2048×1152, Other 2048×1536(QXGA)2560×1600(WQXGA),2560×1440(Quad HD) Also known as different annotations 2K.
4K The name comes from its horizontal resolution of about 4000 Pixels (pixel), Common in the film industry 4K Resolution includes Full Aperture 4K(4096 x 3112)、Academy 4K(3656 × 2664) And so on . For mainstream home appliance manufacturers , They are more inclined to make close 4K Of Quad Full HD(3840×2160) equipment , Because the display scale of this resolution standard is 16:9, It is close to the viewing proportion currently accepted by consumers .
The problem is solved
Usually each model PPI The pixel density is fixed , So a certain number of pixels , Different PPI, The length is different ,PPI The lower the , The longer it is , On the contrary, the lower the length . Back to our original question , Set up 1024 The width of the number of pixels , Because of the local PPI Than remote PPI high , So remote VM The display page width will be wider than the local display . The solution is to set window size Reduce the width by pixels . The original 1024 Change to 1000 That's all right. .
边栏推荐
猜你喜欢
Redis cluster creation, capacity expansion and capacity reduction
Reinstalling the system displays "setup is applying system settings" stationary
IE browser flash back, automatically open edge browser
JMeter linked database
Kubernetes notes (I) kubernetes cluster architecture
Mysql
Advanced technology management - do you know the whole picture of growth?
Kubernetes notes (VI) kubernetes storage
Kubesphere - build MySQL master-slave replication structure
Simple understanding of ThreadLocal
随机推荐
Oauth2.0 - use database to store client information and authorization code
剖析虚幻渲染体系(16)- 图形驱动的秘密
The win7 computer can't start. Turn the CPU fan and stop it
About the difference between count (1), count (*), and count (column name)
【开源项目推荐-ColugoMum】这群本科生基于国产深度学习框架PaddlePadddle开源了零售行业解决方案
[system design] proximity service
Cesium Click to obtain the longitude and latitude elevation coordinates (3D coordinates) of the model surface
Kubernetes notes (10) kubernetes Monitoring & debugging
Project summary --04
【系统设计】邻近服务
有意思的鼠標指針交互探究
Kubernetes notes (VIII) kubernetes security
PHP用ENV获取文件参数的时候拿到的是字符串
Oauth2.0 - Introduction and use and explanation of authorization code mode
Cesium 点击获三维坐标(经纬度高程)
ROS+Pytorch的联合使用示例(语义分割)
Pdf files can only print out the first page
堆排序和优先队列
arcgis创建postgre企业级数据库
scroll-view指定滚动元素的起始位置