Getting Error while dealing with Alert box

Hi,
I’m getting error while dealing with a Alert box which is having two buttons [Yes and No].
tried below code:


driver.switchTo().alert().accept();

Error :

No alert is present (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.21 seconds
Build info: version: ‘2.45.0’, revision: ’32a636c’, time: ‘2015-03-05 22:01:35’
System info: host: ‘NareshG’, ip: ‘10.154.0.7’, os.name: ‘Windows 7’, os.arch: ‘x86’, os.version: ‘6.1’, java.version: ‘1.7.0_45’
Session ID: 4b44bc9d-bac2-455e-a83c-fda186d25108
Driver info: org.openqa.selenium.firefox.FirefoxDriver

Can anyone plaese help me out.

Add Comment
  • 1 Answer(s)

    It seems that either you’re handling alert before it appears.

    Train Answered on June 12, 2015.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.