7、警告框的处理

Posted on 2019-08-25 14:51  小白猫001  阅读(114)  评论(0)    收藏  举报

  在webDriver中处理JavaScript所生成的alert、confirm、以及prompt十分简单,可以使用switch_to_alert()方法定位到alert、confirm、prompt,然后使用text、accept、dismiss、send_keys等方法进行操作

  text:返回alert、confirm、prompt中的文字信息

  accept():接受现有警告框

  dismiss():解散现有警告框

  send_keys(keysToSend):发送文本至警告框