Selenium using python
Question: I am trying to post something on <http://indianrailforums.in> using selenium
script. I am able to login and reach this page:
<http://indiarailinfo.com/blog> using the selenium script, but after I click
post button I am not able to send text in the text area.

This is my code:

    
    
    from selenium import webdriver
    from selenium.common.exceptions import TimeoutException
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    
    driver = webdriver.Firefox()
    
    driver.get("http://indiarailinfo.com")
    element = driver.find_element_by_name("e")
    element.send_keys("yagyank@gmail.com")
    element = driver.find_element_by_name("p")
    element.send_keys("suvrit")
    element.submit()
    driver.get("http://indiarailinfo.com/blog")
    element = driver.find_element_by_link_text('Post')
    element.click()
    element = driver.find_element_by_xpath("/html/body/div[1]/div[5]/table/tbody/tr/td[1]/div[1]/div[1]/div/div/form/textarea")
    #element.sendKeys(Keys.HOME + "abc");
    #element = driver.find_element_by_name("TrainBlog")
    element.send_keys("suvrit")
    #driver.quit()
    

EDIT: Issue solved by using submit button and using driver.implicitly_wait(10)
just before calling xpath


Answer: I was able to post with PhantomJS driver. It should work with Firefox either.

My code is:

    
    
    from selenium import webdriver
    from selenium.common.exceptions import TimeoutException
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    
    driver = webdriver.PhantomJS()
    
    driver.get("http://indiarailinfo.com")
    element = driver.find_element_by_name("e")
    element.send_keys("yagyank@gmail.com")
    element = driver.find_element_by_name("p")
    element.send_keys("suvrit")
    element.submit()
    driver.get("http://indiarailinfo.com/blog")
    element = driver.find_element_by_link_text('Post')
    element.click()
    element = driver.find_element_by_xpath("/html/body/div[1]/div[5]/table/tbody/tr/td[1]/div[1]/div[1]/div/div/form/textarea")
    print element.tag_name
    #element.sendKeys(Keys.HOME + "abc");
    #element = driver.find_element_by_name("TrainBlog")
    element.send_keys("chuh-pook")
    element.submit()
    #driver.quit()
    

