I have :
driver = webdriver.Firefox()
elt = driver.find_element_by_class_name('special_class')
I am afraid there is nothing you can do if the button is opening new window after form submission. Only thing which comes to my mind is to use headless browser like PhantomJS - since you are doing web crawling you could appreciate the speed too. See this tutorial for Python.
But I actually remembered there is a workaround for this, you can set Firefox
1, this should cause every new window to be opened in current one. However I am not sure if this will work well with HTML
fp = webdriver.FirefoxProfile() fp.set_preference("browser.link.open_newwindow", 1) browser = webdriver.Firefox(firefox_profile=fp)
See reference for this feature here.