2
I’m having trouble manipulating popup. Apparently, the popup code is generated in real time, not being captured by Selenium. In fact, it is possible to see the use of jQuery, I did not detect Ajax, but very capable that has also.
QUESTION: My goal is to create a Crawler to take data from various invoices per month, and thus to control the company’s expenses.
Follows code below:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
driver = webdriver.Firefox()
driver.get("http://servicos.coelba.com.br/Pages/Default.aspx")
link = driver.find_element_by_id("ctl00_m_g_bf2869f9_4567_4bf8_bee4_c5c7c5b50e2e_ctl00_rptAplicacoes_ctl02_lnkAplicacao")
link.click()
contratoFieldName = "numcontacontrato"
contratoFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_name(contratoFieldName))
The problem occurs in the last two lines. I cannot manipulate the form field that appears in the popup (or is it window?) and so enter the plate. I’ve used the:
driver.current_window_handle
driver.window_handles
the latter only points to an id. I have tried the following switches:
driver.switch_to
driver.switch_to_alert
driver.switch_to_frame
driver.switch_to_active_element
driver.switch_to_default_content
driver.switch_to_window