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


Python Remote.quit方法代码示例

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


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

示例1: MedicamentsTestLeadersOfSellsTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [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

示例2: RubricPageTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class RubricPageTest(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 = RubricPage(self.driver)
        self.page.open()
        
    def tearDown(self):
        self.driver.quit()

    def test_slider_plate_fields(self):
        self.assertTrue(Slider(self.driver).check_plates())

    def test_slider_nav(self):
        self.assertTrue(Slider(self.driver).check_next_slides_group())
  
    def test_question_list_plate_fields(self):
        self.assertTrue(QuestionsList(self.driver, plate_class=QuestionPlateRubric).check_plates())       

    def test_question_list_nav(self):
        question_list = QuestionsList(self.driver, plate_class=QuestionPlateRubric)
        question_list.go_to_next_page()
        self.assertTrue(question_list.check_plates()) 
         
    def test_open_consult_form(self):
        self.page.open_form()
        self.assertTrue(self.page.is_consult_form_opened())
开发者ID:andyudina,项目名称:homework-4,代码行数:32,代码来源:rubric_page.py

示例3: QuestionPageTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class QuestionPageTest(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 = QuestionPage(self.driver)
        self.page.open()
        
    def tearDown(self):
        self.driver.quit()

    def test_breadcrumbs(self):
        text = self.page.get_breadcrumbs().text
        self.page.get_breadcrumbs().click()
        self.assertGreater(self.page.get_title().find(text), -1)
                
    def test_consultant_link(self):
        self.page.trigger_login()
        self.page.try_login()
        text = self.page.get_consultant_link().text
        self.page.get_consultant_link().click()
        self.assertGreater(self.page.get_title().find(text), -1)
    
    def test_open_consult_form(self):
        self.page.open_form()
        self.assertTrue(self.page.is_consult_form_opened())
开发者ID:andyudina,项目名称:homework-4,代码行数:31,代码来源:question_page.py

示例4: DropdownListTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class DropdownListTest(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 = CompanyPage(self.driver)
        self.page.open()
        self.dropdown_list = self.page.dropdown_list

    def test_scroll(self):
        list_element = u'Бауманская'
        self.page.dropdown_list.open_dropdown_list()
        self.assertFalse(self.dropdown_list.element_is_visible(list_element))
        self.dropdown_list.scroll(list_element)
        self.assertTrue(self.dropdown_list.element_is_visible(list_element))

    def test_dropdown_list_value(self):
        metro_station = u'Бауманская'
        self.assertEquals(u'Любое метро', self.dropdown_list.get_value())
        self.page.dropdown_list.open_dropdown_list()
        self.dropdown_list.select_metro_station(metro_station)
        self.assertEquals(metro_station, self.dropdown_list.get_value())

    def test_selection_metro_stations(self):
        metro_station = u'Бауманская'
        self.page.dropdown_list.open_dropdown_list()
        self.dropdown_list.select_metro_station(metro_station)

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

示例5: OneConsultantPageTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class OneConsultantPageTest(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 = OneConsultantPage(self.driver)
        self.page.open()
        self.page.set_element()
        
    def tearDown(self):
        self.driver.quit()

    def _test_info(self):
        self.assertTrue(ConsultantPlate(self.page.element, self.driver).check_fields())
        
    def _test_question_list(self):
        self.assertTrue(QuestionsList(self.driver).is_valid()) 
         
    def _test_breadcrumbs(self):
        self.page.get_breadcrumbs().click()
        self.assertEqual(self.page.get_title(), self.page.BREADCRUMBS_TITLE)
        
    def test_open_consult_form(self):
        self.page.open_form()
        self.assertTrue(self.page.is_consult_form_opened())
开发者ID:andyudina,项目名称:homework-4,代码行数:29,代码来源:one_consultant_page.py

示例6: CatalogTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [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

示例7: LinksTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class LinksTest(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.contraindication = self.page.contraindication
        self.social_networks = self.page.social_networks
        self.instructions = self.page.instructions

    def test_contraindications(self):
        for link in self.contraindication.links():
            self.assertTrue(self.contraindication.check_link(link))

    def test_instructions(self):
        for link in self.page.instructions.links():
            self.assertTrue(self.page.instructions.check_link(link))

    def test_social_networks(self):
        for link in self.page.social_networks.links():
            self.assertTrue(self.page.social_networks.check_link(link))

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

示例8: ExampleTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class ExampleTest(unittest.TestCase):
    USERNAME = u'Дмитрий Котегов'
    USEREMAIL = '[email protected]'
    PASSWORD = os.environ['TTHA2PASSWORD']
    BLOG = 'Флудилка'
    TITLE = u'ЗаГоЛоВоК'
    MAIN_TEXT = u'Текст под катом! Отображается внутри топика!'

    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()
        )

    def tearDown(self):
        self.driver.quit()

    def test(self):
        auth_page = AuthPage(self.driver)
        auth_page.open()

        auth_form = auth_page.form
        auth_form.open_form()
        auth_form.set_login(self.USEREMAIL)
        auth_form.set_password(self.PASSWORD)
        auth_form.submit()

        user_name = auth_page.top_menu.get_username()
        self.assertEqual(self.USERNAME, user_name)

        create_page = CreatePage(self.driver)
        create_page.open()

        create_form = create_page.form
        create_form.blog_select_open()
        create_form.blog_select_set_option(self.BLOG)
        create_form.set_title(self.TITLE)
        create_form.set_main_text(self.MAIN_TEXT)
        create_form.submit()

        topic_page = TopicPage(self.driver)
        topic_title = topic_page.topic.get_title()
        topic_text = topic_page.topic.get_text()
        self.assertEqual(self.TITLE, topic_title)
        self.assertEqual(self.MAIN_TEXT, topic_text)

        topic_page.topic.open_blog()
        blog_page = BlogPage(self.driver)
        topic_title = blog_page.topic.get_title()
        topic_text = blog_page.topic.get_text()
        self.assertEqual(self.TITLE, topic_title)
        self.assertEqual(self.MAIN_TEXT, topic_text)

        blog_page.topic.delete()
        topic_title = blog_page.topic.get_title()
        topic_text = blog_page.topic.get_text()
        self.assertNotEqual(self.TITLE, topic_title)
        self.assertNotEqual(self.MAIN_TEXT, topic_text)
开发者ID:neikila,项目名称:tech-testing-selenium-demo,代码行数:62,代码来源:example_test.py

示例9: AlphabeticalCatalogCheck

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class AlphabeticalCatalogCheck(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()
        )

        catalog_page = CatalogPage(self.driver)
        catalog_page.open()
        alphabetical_catalog = catalog_page.alphabetical_catalog
        self.letters = alphabetical_catalog.get_catalog_letter_elements()

    def tearDown(self):
        self.driver.quit()

    def test_visibility_of_tooltips_at_hover(self):
        for letter in self.letters:
            letter.hover()
            self.assertEquals(letter.get_visibility_of_tooltip(), u'visible')

    def test_positions_count(self):
        for letter in self.letters:
            self.assertGreater(letter.get_cars_count(), 0)
开发者ID:KhasanovBI,项目名称:home-assignment-4,代码行数:27,代码来源:catalog_page_test.py

示例10: DrugsSearchTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class DrugsSearchTest(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.search_form = self.page.search_form

    def test_search_for_existent_drug(self):
        query = u'ВИЗАРСИН'
        self.search_form.input(query)
        self.search_form.submit()
        drugs = self.search_form.found_drugs()
        self.assertIn(query, drugs)

    def test_search_by_eng(self):
        query = 'VIZARSIN'
        self.search_form.input(query)
        self.search_form.submit()
        drugs = self.search_form.found_drugs()
        self.assertIn(u'ВИЗАРСИН', drugs)

    def test_search_for_non_existent_drug(self):
        query = u'несуществующиетаблетки'
        self.search_form.input(query)
        self.search_form.submit()
        self.assertEquals(None, self.search_form.items())

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

示例11: CompanyListTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [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

示例12: BuyPageTest

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class BuyPageTest(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.driver.get("https://cars.mail.ru/sale/msk/all/")

    def tearDown(self):
        self.driver.quit()

    def test_price_sort(self):
        page = BuyPage(self.driver)
        page.price_sort_btn.click()

        cards = page.read_cards()
        prices = [x.price for x in cards]
        for i in range(0, len(prices) - 1):
            self.assertTrue(prices[i] <= prices[i + 1])

    def test_region(self):
        page = BuyPage(self.driver)
        page.region_btn.click()
        page.region_input.send_keys(u'Казань')
        page.city_first_result.click()
        page.submit_region_btn.click()
        page.apply_filter_lnk.click()
        cards = page.read_cards()
        for x in cards:
            self.assertTrue(x.region == u'Казань')
开发者ID:KhasanovBI,项目名称:home-assignment-4,代码行数:35,代码来源:buy_page_test.py

示例13: amvr

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class amvr(unittest.TestCase):
    def setUp(self):
        self.username = os.environ['SAUCE_USERNAME']
        self.key = os.environ['SAUCE_ACCESS_KEY']
        print os.environ['testenv']
        
        desired_capabilities = DesiredCapabilities.IPHONE
        desired_capabilities['version'] = '5.0'
        desired_capabilities['platform'] = 'MAC'
        desired_capabilities['name'] = 'Testing Selenium 2 in Python at Sauce'

        self.driver = Remote(desired_capabilities=desired_capabilities, command_executor="http://" + self.username + ":" + self.key + "@ondemand.saucelabs.com:80/wd/hub")
        
        self.waiting = WebDriverWait(self.driver, 30)
    
    def test_amvr(self): 
        driver = self.driver
        waiting = self.waiting
        
        driver.get("https://apps.tn.gov/amvr-app/login.html")
        
        waiting.until(expected_conditions.title_is("Log In - Motor Vehicle Records Search"))
        username_textbox = waiting.until(expected_conditions.visibility_of(driver.find_element_by_id("username")))
        password_textbox = waiting.until(expected_conditions.visibility_of(driver.find_element_by_id("password")))
        login_button = waiting.until(expected_conditions.visibility_of(driver.find_element_by_name("login")))
        
        waiting.until(expected_conditions.title_is("Log In - Motor Vehicle Records Search"))
        self.assertIn("amvr-app/login.html", driver.current_url, "Failed to login")
        
    def tearDown(self):
        self.driver.quit()
开发者ID:shawnknight,项目名称:test_project,代码行数:33,代码来源:amvr_test.py

示例14: ExampleTest

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

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

    def tearDown(self):
        self.driver.quit()

    def test(self):
        USERNAME = '[email protected]'
        PASSWORD = os.environ['TTHA2PASSWORD']
        DOMAIN = '@bk.ru'

        auth_page = AuthPage(self.driver)
        auth_page.open()

        auth_form = auth_page.form
        auth_form.set_domain(DOMAIN)
        auth_form.set_login(USERNAME)
        auth_form.set_password(PASSWORD)
        auth_form.submit()

        create_page = CreatePage(self.driver)
        create_page.open()
        email = create_page.top_menu.get_email()

        self.assertEqual(USERNAME, email)
开发者ID:Buratinkalol,项目名称:tech-testing-ha2,代码行数:33,代码来源:example_test.py

示例15: TestOne

# 需要导入模块: from selenium.webdriver import Remote [as 别名]
# 或者: from selenium.webdriver.Remote import quit [as 别名]
class TestOne(object):
    def setup_method(self, method):
        self.driver = Remote(desired_capabilities=DesiredCapabilities().FIREFOX)
        self.home = HomePage(self.driver).open().wait_until_loaded()

    def teardown_method(self, method):
        self.driver.quit()
        
    @pytest.mark.pycon
    @pytest.mark.shallow
    def test_one(self):
        assert(self.home.speak_blurb_title == "SPEAK")

    @pytest.mark.pycon
    @pytest.mark.deep
    @pytest.mark.adam
    def test_one_b(self):
        schedule = self.home.go_to_schedule()
        assert(schedule.tuesday_fake_table_venue == "720 Bathurst Street, suite 500")
        
        
        
        
        
        
        
        
        
        
        
        
        
开发者ID:adamgoucher,项目名称:pyconca2012-webdriver,代码行数:21,代码来源:test_01.py


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