Selenium using python

Legendary_Hunter

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("[email protected]")
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

alecxe

The problem is that you have not submitted the form. Either call submit():

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.send_keys("suvrit")
element.submit()  # it would find the parent form and submit it

Or, click the post button:

post = driver.find_element_by_css_selector('input.postbtn')
post.click()

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Using faker with selenium and python

From Dev

Selenium using python

From Dev

Selenium and Python using If statement

From Dev

Using PhantomJs with Python/Selenium

From Dev

Select checkbox using Selenium with Python

From Dev

Selecting a Button Using Selenium Python

From Dev

submitting captcha with selenium using python

From Dev

Login to reddit using selenium python

From Dev

Using a variable in xpath in Python Selenium

From Dev

Python / Selenium - using a conditional in an xpath

From Dev

Using a variable in Python selenium XPATH

From Dev

Selecting a Button Using Selenium Python

From Dev

Login to reddit using selenium python

From Dev

Using Selenium for clicking on button Python

From Dev

Clicking on button using python + selenium

From Dev

Get value using python selenium

From Dev

How to click on an angularjs link using python selenium?

From Dev

How to add text to a page using python selenium?

From Dev

Trouble connecting to phantomJs webdriver using python and selenium

From Dev

Setting chromedriver proxy auth with Selenium using Python

From Dev

PhantomJS randomly does not exit (using Selenium with Python)

From Java

Selenium using Python - Geckodriver executable needs to be in PATH

From Dev

Using PhantomJS for headless browser in Selenium - Python

From Java

Fill username and password using selenium in python

From Dev

Close dialog box automatically using Selenium python

From Dev

Select check box using Selenium with Python

From Dev

headless-selenium-for-win using Python

From Java

Unable to locate element by xpath using Selenium with Python

From Java

Downloading a PDF using Selenium, Chrome and Python

Related Related

HotTag

Archive