Getting a javascript variable out of a python selenium call
<p>I am currently using Python with selenium to monitor changes to our pbx.  A value I need is being called by a javascript call and is not actually being written to html so it's been a little confusing as to how I can extract the value.  If I inspect the element this is what I see</p>

<pre><code>&lt;input class="SEditorInputText" id="extension_4" maxlength="15" onkeyup="javascript:onEditNumber(this);" onchange="javascript:onPropertyChange(this);" type="text"&gt;
</code></pre>

<p>On the web page it displays the number 1001 which is our huntgroup number.  I am assuming that number is generated by the <b>onkeyup="javascript:onEditNumber(this)</b> function, if so is there a way to get the output to console so that I may evaluate the number assigned?</p>

<p>Here's my selenium code thus far</p>

<pre><code>#!/usr/bin/env python

import time
import sys, urllib2
from selenium import webdriver

driver = webdriver.Firefox()

login_username = '&lt;username&gt;'
login_password = '&lt;password&gt;'

url = '&lt;login Url&gt;'
scripts = '&lt;scripts Url&gt;'

driver.get(url)

username = driver.find_element_by_name("username")
password = driver.find_element_by_name("password")

username.send_keys(login_username)
password.send_keys(login_password)

link = driver.find_element_by_name("loginbutton")
link.click()

driver.get(scripts)

aa = driver.find_element_by_xpath(".//input[contains(@onclick, 'compsci-main-aa.aef')]").click()

opt1 = driver.find_element_by_id('extension_4')
</code></pre>

<p>It so far works as expected going to the section in question but like I mentioned before, I need the value of that variable.  When complete this script will be running headless.</p>

<p>Thanks in advance.</p>