Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This question already has an answer here:

I'm trying to create some simple textcases with Selenium IDE which works quite well so far. There's a problem with recording testcases which include a Javascript alert since Selenium doesn't support those pop-ups. So I tried to use a workaround by clicking just the Enter button when I know that the pop-up is visible.

Let's say that the alert always appears when I'm browsing to one of my html pages. You need to click OK and then you can continue browsing.

I tried to create a testcase with the command "keyPress". But I have absolutely no idea which target to use because there's no element I'm using in this case, I just want to press Enter.

Can anybody help me?

share|improve this question

marked as duplicate by jantimon, Arran, artbristol, Quentin, Graviton Feb 26 '13 at 4:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

selenium cannot capture java script alert so what we can do is put store alert command in the place where the alert will appear what this command will do is it automatically click ok button of the alert

command:StoreAlert

Target:text

text is the variable in which the alert message is stored.

thank you.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.