How to verify the text present in the modal dialog using Selenium Webdriver
<p>I have a webpage which has a 'see Terms' option. On clicking 'see Terms' a modal dialog box opens. I want to verify the text in the modal dialog. The problem I am facing is that how to switch to modal dialog box from the main window. I tried the driver.getWindowHandles() but that dowsn't work. Please suggest how can I switch focus to dialog box and get it's text.</p>

<p>I am using Selenium 2.52.0 and java as a language.</p>

<p><a href="https://i.stack.imgur.com/qqkJJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qqkJJ.png" alt="enter image description here"></a></p>