# Radio buttons can be selected with `text` or `label` locators browser.radio(text='Canada').set() # Date Field elements accept Date objects birthday = fake.date_of_birth() browser.date_field(id='address_birthday').set(birthday) age = fake.date_time_this_year().year - birthday.year browser.text_field(id='address_age').set(age) browser.text_field(id='address_website').set(fake.url()) # File Field elements upload file with the '#set' method, but require the full system path file_name = 'nerodia_example.txt' file = open(file_name, 'w+').close() path = os.path.realpath(file_name) browser.file_field(id='address_picture').set(path) # Checkboxes can be selected by 'label' or 'text' locators browser.checkbox(label='Dancing').set() browser.checkbox(name='address[interest_climb]').set() browser.textarea(id='address_note').set( 'See, filling out a form with Nerodia is as easy as with Watir!') browser.button(data_test='submit').click() sleep(3) browser.quit()
from nerodia.browser import Browser b = Browser(browser='chrome') b.goto("http://toolsqa.com/automation-practice-form/") print(b.title) uploadfile = "/Users/Kerrrlo/Downloads/Photos/boss.jpeg" b.file_field(id="photo").set(uploadfile)