在使用Selenium做自动化测试的时候,难免会碰到下拉选择框,下面几种方式是比较常用的处理方式。
为了方便使用,我自己写了一个HTML的demo:
代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>selenium 处理 下拉框</title>
</head>
<body bgcolor="#f0f8ff">
<h3 align="center">selenium下拉框处理方法</h3>
<hr />
&l

本文介绍了在Selenium自动化测试中处理下拉选择框的三种常见方法:1) 利用Select类及其select_by_index()等方法;2) 定位select后再定位option;3) 直接通过xpath定位。并提醒使用select_by_index()时要注意option的index属性。
1万+

被折叠的 条评论
为什么被折叠?



