【selenium】8、alert弹窗
alert/confirm/prompt弹出框操作主要方法有:
- text:获取文本值
- accept():点击"确认"
- dismiss():点击"取消"或者叉掉对话框
- send_keys():输入文本值--仅限于prompt,在alert或confirm上没有输入框
1、alert弹窗

2、alert.text:获取窗口上的文本
alert.accept():点确定按钮

3、confirm弹窗
- accept():点击"确认"
- dismiss():点击"取消"或者×掉对话框
- text:获取弹窗上的文本

4、prompt弹窗
- accept():点击"确认"
- dismiss():点击"取消"或者x掉对话框
- send_keys():往输入框发送文本
- text:获取弹窗上的文本

本文来自博客园,作者:郭祺迦,转载请注明原文链接:https://www.cnblogs.com/guojie-guojie/p/16161130.html

浙公网安备 33010602011771号