I have an event handler defined like so:
$('#client-input-street1').on('input', function() {
console.debug('street1 text changed');
// Do some other dynamic stuff
});
Where #client-input-street1 is a simple input element:
<input id="client-input-street1" type="text" value="">
I have been unable to trigger this 'input' event using WebDriver. I have tried all manner of techniques such as tabbing to the #client-input-street1 textbox, then send_keys, then tabbing to another form control as described here:
street1_input = self.driver.find_element_by_id('client-input-street1')
street1_input.send_keys('3229 NW Pittock Dr')
street1_input.send_keys(Keys.TAB)
I have tried explicitly setting the value using Javascript:
self.driver.execute_script("document.getElementById('client-input-street1').setAttribute('value', '3229 NW Pittock Dr')")
I have tried clicking the text box, then send_keys, then clicking another element.
I am rendering some content into the DOM inside the 'input' handler, and my Selenium test needs to check some values inside that dynamic content. But I am getting a TimeoutException when waiting for that content to load:
ec = EC.presence_of_element_located((By.ID, 'client-address-suggestions-list'))
address_suggestions_list = wait.until(ec)
Nothing has worked so far. Any ideas would be appreciated.