Unable to locate popup with Chrome in selenium
<p>Before marking this as duplicate, please read the below points, as i have tried all the possible solutions given :</p>

<ol>
<li>Tried switching to alert and accepting it &amp; dismissing it. It gets stuck to the accept statement.</li>
<li>Tried sending the ENTER/RETURN key to the popup. Nothing happens</li>
<li>Tried sending ENTER/RETURN key to the window. Nothing happens</li>
<li>Tried printing browser url without switching to alert. Throws an exception of unexpectedalertpresentexception.</li>
<li>Tried printing the text of the alert. Returns None.</li>
<li>Caught the exception and tried printing the alert_text, returns none. Tried printing msg, returns the popup text.</li>
</ol>

<p>Code Below:</p>

<pre><code>    browser.get("https://www.cnm.att.com/emfe/QNCreateTicket?reportTbl=0&amp;tblValue=DHEC297003811&amp;stateCodeValue=&amp;serviceidtypeValue=&amp;trunkgrpandmessageValue=&amp;testFocusControlID1=idfield1&amp;tblCktValue=DHEC297003811&amp;searchStringForASE=%25DHEC297003811%25&amp;oorInd=null&amp;ASEState=null&amp;isASE_ADEinEMDB=&amp;isASE_ADEinEMDBNotProvisioned=&amp;aseflow=&amp;adeflow=&amp;isASEinEBTA=&amp;searchStringForEditForASE=S%3A2%3ADHEC297003811&amp;button=&amp;clci=&amp;qnfromscreen=quick+navigate&amp;phone=&amp;isProvForTesting=1&amp;isProvForCCA=1&amp;isProvForIP=0&amp;isProvForPhone=1&amp;fromtransporttfn=yes&amp;transporttfn=&amp;circuit_format=&amp;state=&amp;ccid=&amp;cac=&amp;isValidPhoneForUser=&amp;isPOTSDataFound=&amp;localPhoneInd=&amp;circuitId=")
Submit_Ticket = browser.find_element_by_xpath('//*[@id="bottomsec"]/center/table/tbody/tr[2]/td[2]/a/img')
Submit_Ticket.click()

time.sleep(3)


    try:
        print browser.title
    except UnexpectedAlertPresentException as e:
        print "exception "+repr(e)
        print "msg"+e.msg
        print browser.current_window_handle
        b = browser.switch_to.window(browser.current_window_handle)
        print b
        b.send_keys(Keys.RETURN,Keys.ENTER)
</code></pre>

<p>Output:</p>

<pre><code>    exception UnexpectedAlertPresentException()
msgunexpected alert open: {Alert text : Before submitting this ticket, you must select the following fields:

 Trouble Type
 Outage Condition
Do you have Power to your Equipment
Authorize Testing
Service Impact}
  (Session info: chrome=52.0.2743.116)
  (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86)
CDwindow-be1b9858-ddb0-4470-9c11-5f1420a94c82
None

Traceback (most recent call last):
  File "C:\Python27\alert checking.py", line 72, in &lt;module&gt;
    b.send_keys(Keys.RETURN,Keys.ENTER)
AttributeError: 'NoneType' object has no attribute 'send_keys'
</code></pre>

<p><a href="http://i.stack.imgur.com/sl11Q.png" rel="nofollow"><img src="http://i.stack.imgur.com/sl11Q.png" alt="Popup Alert"></a></p>

<p>When i click on the popup only then the code executes further.</p>

<p><a href="http://i.stack.imgur.com/XDAuj.png" rel="nofollow"><img src="http://i.stack.imgur.com/XDAuj.png" alt="Submit Element"></a></p>

<p>Resolved it by upgrading the Chrome Driver to version 2.22, earlier it was 2.21 which is buggy in handling javascript popups.</p>

python selenium-webdriver popup selenium-chromedriver