selenium facebook comment reply
Question: Trying to reply to facebook comments using selenium and python. I've been able
to select the field using

    
    
     find_elements_by_css_selector(".UFIAddCommentInput")
    

But I can't post text using the send_keys method. Heres a simplified structure
of the comment html for facebook:

    
    
    <div><input tabindex="-1" name="add_comment_text">
    <div class="UFIAddCommentInput _1osb _5yk1"><div class="_5yk2">
    <div class="_5yw9"><div class="_5ywb">
    <div class="_3br6">Write a comment...</div></div>
    <div class="_5ywa">
    <div title="Write a comment..." role="combobox"       
    
     class="_54z"contenteditable="true">
    <div data-contents="true">
     <div class="_209g _2vxa">
    


Answer: It works perfectly fine. The only catch being, clear the `div` everytime
before you begin to type a new comment.

    
    
    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    
    f = webdriver.Firefox()
    f.get("https://facebook.com")
    
    # Skipping the logging in and going to a particular post part.
    
    # The selector I used correspond to id of the post and 
    # class of the div that contains editable text part
    e = f.find_element_by_css_selector("div#u_jsonp_8_q div._54-z")
    e.send_keys("bob")
    e.send_keys(Keys.ENTER)
    e.clear()
    
    e.send_keys("kevin")
    e.send_keys(Keys.ENTER)
    e.clear()
    

