本文整理汇总了Python中selenium.webdriver.Remote类的典型用法代码示例。如果您正苦于以下问题:Python Remote类的具体用法?Python Remote怎么用?Python Remote使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Remote类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OneConsultantPageTest
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())
示例2: IsOfficialCheckboxTest
class IsOfficialCheckboxTest(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()
)
def tearDown(self):
self.driver.quit()
def test_filter(self):
page = ShowroomPage(self.driver)
page.open()
search_form = page.search_form
search_form.is_official_checkbox_click()
search_form.submit()
showroom_list = page.showroom_list
items_count = showroom_list.get_items_count()
official_dealers_count = len(showroom_list.get_items_official_dealers())
self.assertEqual(official_dealers_count, items_count, "These dealers are not all official")
page.open()
示例3: DropdownListTest
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()
示例4: MedicamentsTestLeadersOfSellsTest
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()
示例5: BuyPageTest
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'Казань')
示例6: RubricPageTest
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())
示例7: BasicTestCase
class BasicTestCase(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._login()
def tearDown(self):
self.driver.quit()
def _login(self):
auth_page = AuthPage(self.driver)
auth_page.open()
logged_in = auth_page.login(USERNAME, DOMAIN, PASSWORD)
if not logged_in:
raise Exception("Couldn't login")
def _fill_basic_settings(self, ad_page):
base_settings = ad_page.campaign_base_settings
base_settings.set_campaign_name(CAMPAIGN_NAME)
base_settings.set_product_type(PRODUCT_TYPE)
base_settings.set_pad_type(PAD_TYPE)
示例8: TestOne
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")
示例9: ConsultantsPageTest
class ConsultantsPageTest(unittest.TestCase):
RUBRIC = u'Кардиология'
RUBRIC_URL = 'cardiology'
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 = ConsultantsPage(self.driver)
self.page.open()
def tearDown(self):
self.driver.quit()
def test_select_rubric(self):
self.page.select_rubric(self.RUBRIC)
self.assertGreater(self.driver.current_url.find(self.RUBRIC_URL), -1)
def test_select_sort_type(self):
self.page.select_friendly_sort()
self.assertEqual(self.page.get_current_tab_text(), self.page.FRIENDLY)
def test_open_consult_form(self):
self.page.open_form()
self.assertTrue(self.page.is_consult_form_opened())
示例10: CompanySearchTest
class CompanySearchTest(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.search = self.page.search
def test_search_existing_companies(self):
query = u'Аптека'
self.search.input(query)
self.search.submit()
#self.page.wait_for_another_page()
self.assertNotEqual(0, len(self.search.found_companies()))
def test_search_non_existent(self):
query = u'aaaaaaaaaaaa'
self.search.input(query)
self.search.submit()
#self.page.wait_for_another_page()
self.assertEqual(0, len(self.search.found_companies()))
def tearDown(self):
# self.page.close()
self.driver.quit()
示例11: CatalogTest
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()
示例12: DrugsSearchTest
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()
示例13: QuestionPageTest
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())
示例14: LinksTest
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()
示例15: MedicamentsClassificationTest
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()