Skip to content

Targeting field by type "email" and "password" #22

@jabrake

Description

@jabrake

Hello,

I tried modifying the "find_field_by" function to find a text field by type, and later "clear" and "send_keys" in order to fill out a form. Specifically, I'm trying to target two fields: type="email" and type="password" but I get the following error message (doesn't get past filling the e-mail field in the test):

AssertionError: And I fill in field with type "email" with "[email protected]", failed because: Message: u'Element is not currently visible and so may not be interacted with' ; Stacktrace: Method fxdriver.preconditions.visible threw an error in file:///var/folders/xo/xoXGh2V+E70Th0NlE8tkIk+++TM/-Tmp-/tmpjm7c8r/extensions/[email protected]/components/command_processor.js

This is the function I'm using to target these fields:

@step('I fill in field with type "(.?)" with "(.?)"')
def fill_in_textfield_by_type(step, field_type, value):
with AssertContextManager(step):
text_field = find_field_by_type(world.browser, field_type)
assert_false(step, text_field is False,'Can not find a field with type "%s"' % field_type)
text_field.clear()
text_field.send_keys(value)

And the "find_field_by_type" function:

def find_field_by_type(browser, attribute):
xpath = "//input[@type='%s']" % attribute
elems = browser.find_element_by_xpath(xpath)
return elems

Any suggestions on creating a function to properly target these elements and fill them out?

Thanks,
Jorge

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions