I'm having trouble manipulating popup. It appears that 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 quite capable of having it too.
QUESTION: My goal is to create a crawler to take data from several invoices per month, and thus control the company's expenses.
Follow the 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 can not manipulate the form field that appears in the popup (or will it be window?) And thus insert the license plate. I already used the:
driver.current_window_handle
driver.window_handles
The latter only points to an id. I've 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