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
Post a Comment