How do I get the text in an alert/prompt/dialog in perl with selenium webdriver? How do I get the text in an alert/prompt/dialog in perl with selenium webdriver? selenium selenium

How do I get the text in an alert/prompt/dialog in perl with selenium webdriver?


One way is to override the prompt function in the page with a script injection:

# override the prompt function$d->execute_script('window.prompt=function(message, input){window.last_prompt = {message: message, input: input}};');# trigger a promptselect undef, undef, undef, 8.00;# get the prompt default inputmy $input = $d->execute_script('return window.last_prompt.input;');