selenium webdriver: form data not present after submit
I have a page in which I log in and then fill in some forms. After submitting the first form, a new page appears with new forms. Some data is taken from the forms before (as it should be), but some data is missing.
If I do exactly the same I do with webdriver by hand, everything works fine and all the data from form 1 is present in form 2.
The Code is pretty simple:
from selenium import webdriver
from time import sleep
driver = webdriver.Firefox()
driver.get("http://www.example.com")
### login ###
driver.find_element_by_id("UserName").send_keys("foo")
driver.find_element_by_id("Password").send_keys("bar")
driver.find_element_by_id("LoginButton").click()
# fill first form and submit
driver.find_element_by_id("Info").send_keys("data")
driver.find_element_by_id("info2").send_keys("data2")
driver.find_element_by_id("Submit").click()
# new page where "data" should be present but isn't
# ...
What am I doing wrong?
I thought I may have 开发者_如何学Cto use cookies? If so, how do I use them? Just found C# examples and don't know where to import the Cookie class from.
Visit the cookie section of this tutorial http://readthedocs.org/docs/selenium-python/en/latest/navigating.html
精彩评论