browser.link(data_test='addresses').click() browser.link(data_test='create').click() # This uses the Faker Library to give us Random Data. # Read more about Faker Library here: https://pypi.org/project/Faker/ fake = Faker() # So we can use fake.name() instead of Faker().name() browser.text_field(id='address_first_name').set(fake.first_name()) browser.text_field(id='address_last_name').set(fake.last_name()) browser.text_field(id='address_street_address').set(fake.street_address()) browser.text_field(id='address_secondary_address').set( fake.secondary_address()) browser.text_field(id='address_city').set(fake.city()) # Select list elements can select by either `text` or `value` browser.select_list(id='address_state').select(fake.state()) browser.text_field(id='address_zip_code').set(fake.postcode()) # 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())
) print(text2) 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()