def __init__(self, driver): super().__init__(driver) self.product_name_label = Label( locator="[style*='display: block'] #layer_cart_product_title", description="Product name label", ) self.product_attributes = Label( locator="[style*='display: block'] #layer_cart_product_attributes", description="Product attributes label", ) self.product_successfully_added_label = Label( locator="[style*='display: block'] .layer_cart_product h2", description="Label 'Product successfully added to your shopping cart'", ) self.continue_shopping_button = Button( locator="[style*='display: block'] .continue", description="Button 'Continue shopping'", ) self.proceed_to_checkout_label = Button( locator="[style*='display: block'] [title='Proceed to checkout']", description="Button 'Proceed to checkout'", ) self.close_window_button = Button( locator="[style*='display: block'] .cross", description="Close window button 'x'", )
def __init__(self, driver): super().__init__(driver) self.add_to_cart_1_button = Button( "(//*[text()='Add to cart'])[1]/..", "xpath", ) self.result_title_1_label = Label( "(//*[contains(text(),'Printed Summer Dress')])[4]", "xpath") self.sort_by_dropdown = Dropdown("#selectProductSort", 'css') self.proceed_to_checkout_button = Button( "//*[contains(text(),'Proceed to checkout')]", 'xpath')
def __init__(self, driver): super().__init__(driver) self.best_sellers_button = Button( ".blockbestsellers", "css" ) self.search_input = Input( "search_query", "name" ) self.search_button = Button( "submit_search", "name" )
def __init__(self, driver): super().__init__(driver) self.create_an_account_button = Button( locator="SubmitCreate", locatorType="name", description="Button 'Create an account'") self.create_an_account_email_address_label = Label( locator= ".//form[@id='create-account_form']//label[text()='Email address']", locatorType="xpath", description="Label 'Email address'") self.create_an_account_email_address_input = Input( locator=".//input[@name='email_create']", locatorType="xpath", description="Input 'Email address'") self.authentication_label = Label( locator="//div[@id='center_column']/h1[@class='page-heading']", locatorType="xpath", description="Label 'AUTHENTICATION'") self.create_account_alert_label = Label( "#create_account_error li", description= "Label z informacją o nieprawidłowej wartości w polu 'Email address'" )
def item_details(self, browser, product_num): item_tile = Label( ".product_list > li:nth-of-type({})".format(product_num)) more_button = Button( "(//span[text()='More']/ancestor::a)[{}]".format(product_num), 'xpath') ActionChains(browser).move_to_element( item_tile.webelement).move_to_element( more_button.webelement).click().perform()
def add_item_to_cart(self, browser, product_num): item_tile = Label( ".product_list > li:nth-of-type({})".format(product_num)) add_to_cart_button = Button( "(//span[text()='Add to cart']/ancestor::a)[{}]".format( product_num), 'xpath') ActionChains(browser).move_to_element( item_tile.webelement).move_to_element( add_to_cart_button.webelement).click().perform()
def __init__(self, driver): super().__init__(driver) self.product_title = Label( locator="[itemprop='name']", description="Product title label" ) self.model_label = Label( locator="#product_reference", description="Model label" ) self.condition_label = Label( locator="#product_condition", description="Condition label" ) self.short_description_label = Label( locator="#short_description_content", description="Short description label" ) self.add_to_cart_button = Button( locator="#add_to_cart > button > span", description="Button 'Add to cart'" )
def __init__(self, driver): Element.driver = driver self.sign_in_button = Button(locator=".login", description="Button 'Sign in'") self.contact_us_button = Button(locator="[title=Contact Us]", description="Button 'Contact us'") self.search_input = Input(locator="#search_query_top", description="Input 'Search'") self.search_button = Button(locator="submit_search", locatorType="name", description="Button lupy") self.cart_dropdown = Dropdown(locator=".shopping_cart > a", description="Dropdown 'Cart'") self.number_of_products_in_cart = Label( locator="//div[@class='shopping_cart']/a", locatorType="xpath", description="Number of elements in cart") self.women_button = Button(locator="[title='Women']", description="Button 'WOMEN'") self.dresses_button = Button(locator="[title='Dresses']", description="Button 'DRESSES'") self.tshirts_button = Button(locator="[title='T-shirts']", description="Button 'T-SHIRTS'")
def __init__(self, driver): super().__init__(driver) self.page_heading_label = Label( locator=".page-heading", description="Label 'CREATE AN ACCOUNT'") # Section "YOUR PERSONAL INFORMATION" self.your_personal_information_label = Label( locator= "//div[@class='account_creation'][1]/h3[@class='page-subheading']", locatorType="xpath", description="Label 'YOUR PERSONAL INFORMATION'") self.title_radiogroup = RadioGroup( locator="//label[text()='Title']//following-sibling::div", locatorType="xpath", description="Title radio group 'Mr.'/'Mrs.'") self.first_name_input = Input(locator="#customer_firstname", description="Input 'First name'") self.last_name_input = Input(locator="#customer_lastname", description="Input 'Last name'") self.email_input = Input(locator="#email", description="Input 'Email'") self.password_input = Input(locator="#passwd", description="Input 'Password '") self.date_of_birth_days_dropdown = Dropdown( locator="#days", description="Dropdown Date of Birth - dni") self.date_of_birth_months_dropdown = Dropdown( locator="#months", description="Dropdown Date of Birth - miesiące") self.date_of_birth_years_dropdown = Dropdown( locator="#years", description="Dropdown Date of Birth - lata") self.sign_up_checkbox = Checkbox( locator="#uniform-newsletter input#newsletter", description="Checkbox 'Sign up for our newsletter!'") self.receive_special_offers_checkbox = Checkbox( locator="#uniform-optin input#optin", description="Checkbox 'Sign up for our newsletter!'") self.your_address_label = Label(locator=".page-subheading", description="Label 'YOUR ADDRESS'") # Section "YOUR ADDRESS" self.your_address_label = Label( locator= "//div[@class='account_creation'][2]/h3[@class='page-subheading']", locatorType="xpath", description="Label 'YOUR ADDRESS'") self.first_name_address_input = Input(locator="firstname", locatorType="name", description="Input 'First name'") self.last_name_address_input = Input(locator="lastname", locatorType="name", description="Input 'Last name'") self.company_input = Input(locator="#company", description="Input 'Company'") self.address_input = Input(locator="[name=address1]", description="Input 'Address'") self.address_line_2_input = Input( locator="address2", locatorType="name", description="Input 'Address (Line 2)'") self.city_input = Input(locator="#city", description="Input 'City'") self.state_dropdown = Dropdown(locator="#id_state", description="Dropdown 'State'") self.zip_postal_code_input = Input( locator=".uniform-input", description="Input 'Zip/Postal Code'") self.country_dropdown = Dropdown(locator="#id_country", description="Dropdown 'Country'") self.additional_information_input = Input( locator="#other", description="Input 'Additional information'") self.home_phone_input = Input(locator="#phone", description="Input 'Home phone'") self.mobile_phone_input = Input(locator="#phone_mobile", description="Input 'Mobile phone'") self.assign_an_address_alias_input = Input( locator="#alias", description="Input 'Assign an address alias for future reference'") self.register_button = Button(locator="#submitAccount", description="Button 'Register'")