alter对象
方法 | 说明 |
switch_to_alter() | 切到alter,返回一个alter对象 |
accpet() | 确认 |
dismiss() | 取消 |
send_keys | 有输入框才可以使用,否则报错 |
<!DOCTYPE html> <html lang="en"> <head> alter and confirm <title>selenium</title> <script type="text/javascript"> function display_alert() { alert("I am an alter box!!" ) } function show_confirm() { var r=confirm('Press a button!'); if (r = true){ alert("Press ok") } else { alert("Press cancel") } } </script> </head> <body> <div><input type="button" onclick="display_alert()" value="Alter" id="alter"></div> <div><input type="button" onclick="show_confirm()" value="Confirm" id="confirm"></div> </body>