Exemplo n.º 1
0
from nerodia.browser import Browser

browser = Browser(browser='firefox')
browser.goto("http://toolsqa.com/automation-practice-form/")
print(browser.title)

#select a checkbox
browser.checkbox(id="tool-0").set()
#deseclect a checkbox
browser.checkbox(id="tool-0").clear()

browser.close()
Exemplo n.º 2
0
# 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()
Exemplo n.º 3
0
text3 = browser.element(
    text=
    "Always click on the ads display at the right side, this is how we manage the website’s expenses and bring free content for the beginners."
)
print(text3.text)

browser.link(text="Partial Link Test").wait_until_present().click()
browser.link(text="Link Test").wait_until_present().click()
browser.back()

browser.text_field(name="firstname").wait_until_present().set("Fname")
browser.text_field(name="firstname").clear()
browser.select_list(id="continents").select("Antartica")
browser.select_list(id="selenium_commands").select("Switch Commands")
browser.button(id="submit")

browser.radio(id="sex-0").set()
browser.radio(id="sex-1").set()
browser.radio(id="exp-2").set()
browser.text_field(id="datepicker").set("mmddyy")
browser.checkbox(value="Automation Tester").set()
browser.checkbox(id="profession-0").set()

browser.link(text="Test File to Download").click()
browser.checkbox(id="tool-0").set()
browser.checkbox(id="tool-0").clear()
browser.checkbox(id="tool-2").set()

browser.close()