当前位置: 首页>>代码示例>>Python>>正文


Python Remote.back方法代码示例

本文整理汇总了Python中selenium.webdriver.Remote.back方法的典型用法代码示例。如果您正苦于以下问题:Python Remote.back方法的具体用法?Python Remote.back怎么用?Python Remote.back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在selenium.webdriver.Remote的用法示例。


在下文中一共展示了Remote.back方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CompanyListTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import back [as 别名]
class CompanyListTest(unittest.TestCase):
    def setUp(self):
        browser = os.environ.get('HW4BROWSER', 'CHROME')

        self.driver = Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities, browser).copy()
        )
        self.page = CompaniesPage(self.driver)
        self.page.open()
        self.list = self.page.company_list

    def test_check_links(self):
        for link in self.list.links():
            self.assertTrue(self.list.check_link(link))

    def test_check_redirect(self):
        companies = self.list.get_all_companies()
        for i in companies:
            self.list.go_to_company_page(i)
            #self.page.wait_for_another_page()
            expected_title = i + u" в Москве"
            self.assertEquals(expected_title, self.page.get_title())
            self.driver.back()

    def tearDown(self):
       # self.page.close()
        self.driver.quit()
开发者ID:andyudina,项目名称:homework-4,代码行数:30,代码来源:company_list_test.py

示例2: CatalogTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import back [as 别名]
class CatalogTest(unittest.TestCase):
    def setUp(self):
        browser = os.environ.get('HW4BROWSER', 'CHROME')

        self.driver = Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities, browser).copy()
        )
        self.page = DrugsPage(self.driver)
        self.page.open()
        self.catalog = self.page.catalog

    def test_check_link(self):
        for link in self.catalog.links():
            self.assertTrue(self.catalog.check_link(link))

    def test_check_redirect(self):
        text = u"Витамины"
        self.catalog.to_link(text)
        #self.page.wait_for_another_page()
        self.assertEquals(text, self.page.get_title())
        self.driver.back()
        text = u"Миорелаксанты"
        self.catalog.to_link(text)
        #self.page.wait_for_another_page()
        self.assertEquals(text, self.page.get_title())

    def tearDown(self):
        #self.page.close()
        self.driver.quit()
开发者ID:andyudina,项目名称:homework-4,代码行数:32,代码来源:catalog_test.py

示例3: MedicamentsClassificationTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import back [as 别名]
class MedicamentsClassificationTest(unittest.TestCase):
    def setUp(self):
        browser = os.environ.get('TTHA2BROWSER', 'CHROME')

        self.driver = Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities, browser).copy()
        )
        self.page = MedicamentsPage(self.driver)
        self.page.open()
        self.classification_list = self.page.classification

    def test_drug_type_selection(self):
        text = u"Витамины"
        self.classification_list.to_link(text)
        self.page.wait_for_another_page()
        self.assertEquals(text, self.classification_list.get_title())
        self.driver.back()
        text = u"Миорелаксанты"
        self.classification_list.to_link(text)
        self.page.wait_for_another_page()
        self.assertEquals(text, self.classification_list.get_title())

    def tearDown(self):
        self.page.close()
        self.driver.quit()
开发者ID:allavlasova,项目名称:homework-4,代码行数:28,代码来源:medicament_classification_test.py

示例4: MedicamentsTestLeadersOfSellsTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import back [as 别名]
class MedicamentsTestLeadersOfSellsTest(unittest.TestCase):
    def setUp(self):
        browser = os.environ.get('HW4BROWSER', 'CHROME')

        self.driver = Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities, browser).copy()
        )
        self.page = MedicamentsPage(self.driver)
        self.page.open()
        self.list = self.page.leaders_of_sells

    def test_select_one_from_list(self):
        drug = self.list.get_drags_name(2)
        self.list.go_to_drugs_page(drug)
        self.page.wait_for_another_page()
        self.assertEquals(drug, self.list.result_drag())
        self.driver.back()
        drug = self.list.get_drags_name(4)
        self.list.go_to_drugs_page(drug)
        self.page.wait_for_another_page()
        self.assertEquals(drug, self.list.result_drag())


    def tearDown(self):
        self.page.close()
        self.driver.quit()
开发者ID:allavlasova,项目名称:homework-4,代码行数:29,代码来源:medicament_leaders_of_sells_test.py

示例5: AnalogsTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import back [as 别名]
class AnalogsTest(unittest.TestCase):
    def setUp(self):
        browser = os.environ.get('HW4BROWSER', 'CHROME')

        self.driver = Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities, browser).copy()
        )
        self.page = DrugPage(self.driver, 'vizarsin')
        self.page.open()
        self.analogs = self.page.analogs

    def test_analogs(self):
        drags_names = self.page.analogs.get_names()
        for name in drags_names:
            self.page.analogs.go_to_drugs_page(name)
            #self.page.wait_for_another_page()
            self.assertEquals(name.split(',')[0], self.page.analogs.result_drag())
            self.driver.back()

    def tearDown(self):
       # self.page.close()
        self.driver.quit()
开发者ID:andyudina,项目名称:homework-4,代码行数:25,代码来源:analogs_test.py

示例6: MedicamentsTestLeadersOfSellsTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import back [as 别名]
class MedicamentsTestLeadersOfSellsTest(unittest.TestCase):
    def setUp(self):
        browser = os.environ.get('HW4BROWSER', 'CHROME')

        self.driver = Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities, browser).copy()
        )
        self.page = DrugsPage(self.driver)
        self.page.open()
        self.drugs = self.page.leaders_of_sells

    def test_check_redirect(self):
        drags_names = self.drugs.get_all()
        for name in drags_names:
            self.drugs.go_to_drugs_page(name)
            #self.page.wait_for_another_page()
            self.assertEquals(name, self.page.get_title())
            self.driver.back()

    def tearDown(self):
        #self.page.close()
        self.driver.quit()
开发者ID:andyudina,项目名称:homework-4,代码行数:25,代码来源:leaders_os_sells_test.py

示例7: CounterTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import back [as 别名]
class CounterTest(unittest.TestCase):
    def setUp(self):
        browser = os.environ.get('HW4BROWSER', 'CHROME')

        self.driver = Remote(
            command_executor='http://127.0.0.1:4444/wd/hub',
            desired_capabilities=getattr(DesiredCapabilities, browser).copy()
        )
        self.page = DrugPage(self.driver, 'vizarsin')
        self.page.open()
        self.counter = self.page.counter

    def test_counter_visible(self):
        self.assertFalse(self.counter.counter_is_visible())
        self.counter.to_order()
        self.counter.selected_dropdown_item_by_number(1)
        self.assertTrue(self.counter.counter_is_visible())

    def test_counter(self):
        self.page.login()
        self.counter.to_order()
        self.counter.selected_dropdown_item_by_number(1)
        self.assertEquals(1, int(self.counter.get_counter_value()))
        self.counter.increment()
        self.counter.increment()
        self.assertEquals(3, int(self.counter.get_counter_value()))
        self.counter.decrement()
        self.assertEquals(2, int(self.counter.get_counter_value()))

    def test_counter_in_basket(self):
        self.page.login()
        self.counter.to_order()
        self.counter.selected_dropdown_item_by_number(1)
        self.counter.do_order()
        #self.page.wait_for_another_page()
        self.assertEquals(1, int(self.counter.get_counter_value()))
        self.driver.back()
        self.counter.increment()
        self.counter.increment()
        self.counter.do_order()
        #self.page.wait_for_another_page()
        self.assertEquals(3, int(self.counter.get_counter_value()))
        self.driver.back()
        self.counter.decrement()
        self.counter.do_order()
        #self.page.wait_for_another_page()
        self.assertEquals(2, int(self.counter.get_counter_value()))

    def test_negative_counter_value(self):
        self.counter.to_order()
        self.counter.selected_dropdown_item_by_number(1)
        self.counter.decrement()
        self.assertFalse(self.counter.counter_is_visible())

    def test_check_type(self):
        self.page.login()
        self.counter.to_order()
        types = self.counter.dropdown_items()
        for t in types:
            self.counter.selected_dropdown_item(t)
            self.counter.do_order()
         #   self.page.wait_for_another_page()
            self.assertEquals(t, self.counter.result_type())
            self.driver.back()
            self.counter.decrement()
            self.counter.to_order()

    def tearDown(self):
        #self.page.close()
        self.driver.quit()
开发者ID:andyudina,项目名称:homework-4,代码行数:72,代码来源:counter_test.py

示例8: Browser

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import back [as 别名]
class Browser(object):
    def __init__(self, harness, selenium_server_url, selenium_browser, width=1024, height=600):
        self.harness = harness
        self.selenium_server_url = selenium_server_url
        self.selenium_browser = selenium_browser
        self.width = width
        self.height = height

        self.selenium = Remote(
            self.selenium_server_url.encode('ascii'),
            desired_capabilities = {
                'browserName': self.selenium_browser,
            },
        )
        self.selenium.set_window_size(width, height)

    def __enter__(self):
        self.harness.browser_stack.append(self)
        return self

    def __exit__(self, type, value, traceback):
        if self.harness.browser_stack[-1] != self:
            raise Exception("Unexpected browser on the top of the stack")
        self.harness.browser_stack.pop()
        return

    def shutdown(self):
        self.selenium.quit()

    def back(self):
        self.selenium.back()

    def refresh(self):
        self.selenium.refresh()

    def title(self):
        return self.selenium.title

    def source(self):
        return self.selenium.page_source

    def get(self, uri):
        self.selenium.get(uri)

    def find(self, selector):
        return WebElementSet(self, elements=self.selenium).find(selector)

    def add_cookie(self, cookie_dict):
        self.selenium.add_cookie(cookie_dict)

    def get_cookie(self, name):
        return self.selenium.get_cookie(name)

    def endpoint(self):
        return self.find('html').attr('id').replace('endpoint-', '').replace('-', '.')

    def endpoint_is(self, endpoint):
        is_equal(self.endpoint(), endpoint, "Endpoint is correct")

    def wait_for_bootstrap_modal(self):
        last = [None]

        def inner_wait(driver):
            value = self.find('.modal')[-1].css('top')
            if last[0] and last[0] == value:
                return True
            last[0] = value
            return False
        WebDriverWait(self.selenium, 3).until(inner_wait)
        return self

    def url(self):
        return furl(self.selenium.current_url)

    def execute_script(self, script):
        return self.selenium.execute_script(script)

    def wait_for_ajax(self):
        WebDriverWait(self.selenium, 10).until_not(lambda x: x.execute_script('return jQuery.active'))
        return self

    def wait_for_jquery(self):
        WebDriverWait(self.selenium, 10).until(lambda x: x.execute_script('return window.jQuery ? true : false'))
        return self

    def screenshot(self, message="Screenshot: "):
        if 's3_access_key' not in app.settings.options('test'):
            print "No screenshot S3 instance configured - skipping screenshot"
            return

        if not hasattr(self, 's3_connection'):
            if 's3_host' in app.settings.options('test'):
                self.s3_connection = boto.s3.connection.S3Connection(
                    app.settings.get('test', 's3_access_key'),
                    app.settings.get('test', 's3_secret_key'),
                    host = app.settings.get('test', 's3_host'),
                )
            else:
                self.s3_connection = boto.s3.connection.S3Connection(
                    app.settings.get('test', 's3_access_key'),
#.........这里部分代码省略.........
开发者ID:shoptime,项目名称:trex,代码行数:103,代码来源:browser.py


注:本文中的selenium.webdriver.Remote.back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。