今天在处理页面的弹出框(alert)时,发现Get Alert Message 并不如字面意思这么简单

函数说明如下:

Selenium2Library中的Get Alert Message

很明了:(1)返回alert 的text

              (2)如果没有alert,则该keyword 会失败

 

到底是不是这样呢? 源码会告诉我们答案,看下图:

Selenium2Library中的Get Alert Message

纳尼 ,竟然是"close”...................... 

这是要搞嘛???

 

各位看官,既然有疑问,那就接着往下看:

Selenium2Library中的Get Alert Message

有两点:(1)如果不是confirm就叉掉,否则确定

    (2)返回text

 

Okey,终于明白在使用Get Alert Message后再次操作alert为什么会报异常.................

 

 

ps:

splitlines是按行分割字符串,返回值也是个列表

join此处是用' '来splitlines按行分割后的字符串列表

 

相关文章:

  • 2022-12-23
  • 2021-07-19
  • 2021-04-09
  • 2021-08-12
  • 2021-07-17
  • 2021-07-08
  • 2021-07-05
  • 2022-01-04
猜你喜欢
  • 2021-12-03
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
  • 2022-01-11
相关资源
相似解决方案