0
votes

I am trying to fill out a form using Selenium in Python. The text fields work correctly, but when I use send text to the date fields, it does not work correctly. It appears to input blank spaces.

Here is the code:

h_dob_field = firefox.find_element_by_id(
            'MainContent_txtHDateofBirth'
    ).send_keys('01012001')

The console log shows that this is being sent:

 2016-02-16 17:24:38,934 - DEBUG - POST http://127.0.0.1:45672/hub/session/283ad883-ac6a-4f25-b747-26f61cb897fc/element/{cc4f0cd1-ef8a-41f5-bf0e-615b6a970031}/value {"id": "{cc4f0cd1-ef8a-41f5-bf0e-615b6a970031}", "sessionId": "283ad883-ac6a-4f25-b747-26f61cb897fc", "value": ["2", "1", "3", "1", "9", "6", "2"]}

The html I'm targeting is:

<input class="" name="ctl00$MainContent$txtHDateofBirth" id="MainContent_txtHDateofBirth" type="text">

The page that I'm trying to input data to is here.

I've read some other answers that said I should try to call the click() method. I did that, but it didn't have an effect. I'm using the firefox driver; Python 3.4, on Linux Mint, and it is the latest version of selenium.

1

1 Answers

0
votes

You could use fiddler to capture the request for when you fill out the form manually and write a custom web request based on your findings.

Another option is to use the use the selenium IDE extension for Firefox (link) and use it record feature to record you steps and have it made for you.