seldom icon indicating copy to clipboard operation
seldom copied to clipboard

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

Open tzk1986 opened this issue 2 years ago • 4 comments

测试用网站: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

tzk1986 avatar Feb 21 '23 05:02 tzk1986

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

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

image

defnngj avatar Feb 21 '23 07:02 defnngj

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

defnngj avatar Feb 21 '23 15:02 defnngj

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

tzk1986 avatar Feb 22 '23 06:02 tzk1986

image image

yanxin152133 avatar Jun 07 '24 03:06 yanxin152133