class GroupHelper:

    def __init__(self, app):
        self.app = app

    def create(self, group):
        wd = self.app.wd
        wd.get_screenshot_as_file("screenshot.png")
        wd.find_element_by_name("new").click()
        wd.find_element_by_name("group_name").click()
        wd.find_element_by_name("group_name").clear()
        wd.find_element_by_name("group_name").send_keys(group.name)
        wd.find_element_by_name("group_header").click()
        wd.find_element_by_name("group_header").clear()
        wd.find_element_by_name("group_header").send_keys(group.header)
        wd.find_element_by_name("group_footer").click()
        wd.find_element_by_name("group_footer").clear()
        wd.find_element_by_name("group_footer").send_keys(group.footer)
        wd.find_element_by_name("submit").click()

    def delete_first(self):
        wd = self.app.wd
        wd.find_element_by_css_selector("input[type='checkbox']").click()
        wd.find_element_by_name("delete").click()

    def open_group_page(self):
        wd = self.app.wd
        wd.find_element_by_css_selector("a[href='group.php']").click()
        wd.find_element_by_css_selector("a[href='group.php']").click()
        #wd.find_element_by_link_text("Группы").click()