Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当弹出框是prompt提示框时,需要输入文本,seldom中怎么处理? #166

Open
tzk1986 opened this issue Feb 21, 2023 · 3 comments

Comments

@tzk1986
Copy link

tzk1986 commented Feb 21, 2023

测试用网站:https://liushilive.github.io/html_example/index.html
使用seldom进行web自动化,在prompt提示框时需要输入文本
image
在使用seleium时,可以选择switch_to.alert,然后直接send_keys如下
image
在seldom中没有switch_to.alert,有的是直接获取警告信息或者确定和取消,链式处理Steps中有alert,但是无法实现输入
s.find("#b2").click().alert().type("shishi") s.accept()
image

@defnngj
Copy link
Collaborator

defnngj commented Feb 21, 2023

seldom 的链式调用: alert().type("shishi") 其中, type() 是针对普通输入框的。 目前警告框上面的输入不支持。

seldom 中没有封装 警告框的输入方法。你可以按照selenium 的方法用, 参考:

image

defnngj added a commit that referenced this issue Feb 21, 2023
@defnngj
Copy link
Collaborator

defnngj commented Feb 21, 2023

我又尝试了一下。 selenium 提供的 switch_to.alert.send_keys() 不能操作 prompt 的输入。

@tzk1986
Copy link
Author

tzk1986 commented Feb 22, 2023

嗯,不过测试网站上,使用switch_to.alert.send_keys(),在返回的警告框的信息上,是展示输入的数据的。不知道是不是selenium内部有处理。
image
我还看了下其他博客
里面有说到selenium的 prompt 的输入处理,应该是可行的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants