python - How can we send message by pressing enter in a chat window using splinter? -


in chat window ( watsapp, facebook etc. ) message can sent pressing "enter", how can achieve in splinter. tried submitting form using browser.execute_script() reloading full page instead.

also tried browser.get_by_id("id_name").type("something \r") didn't work.

after experimenting code worked me:

from splinter import browser browser = browser() script = 'var event = jquery.event("keydown"); event.which = 13; event.keycode = 13; $("#element_id").trigger(event);' browser.execute_script(script) 

i found people using jquery.event("keypress") didn't worked me.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -