def test_register_locators_merge(self): """Verify that calling register_locators will merge the new locators with existing locators for a given prefix, rather than replacing them. """ register_locators("test1", {"foo": {"one": "//div/one"}}) register_locators("test1", {"foo": {"two": "//div/two"}}) expected = {"test1": {"foo": {"one": "//div/one", "two": "//div/two"}}} self.assertDictEqual(LOCATORS, expected)
def setUpClass(cls): super().setUpClass() LOCATORS.clear() register_locators( prefix="test", locators={"foo": { "bar": { "hello": "//span[text()='Hello, {}']" } }}, )
def setUpClass(cls): super().setUpClass() LOCATORS.clear() register_locators( prefix="test", locators={ "foo": { "message": "{} {}", "bar": { "baz": "//div[@class='baz']", "hello": "//span[text()='Hello, {}']", }, } }, )
def test_multiple_registrations(self): """Verify that more than one prefix can be registered""" register_locators("test1", {"foo": "//div/foo"}) register_locators("test2", {"bar": "//div/bar"}) expected = { "test1": { "foo": "//div/foo" }, "test2": { "bar": "//div/bar" } } self.assertDictEqual(LOCATORS, expected)
def initialize_location_strategies(self): """Initialize the Salesforce location strategies 'text' and 'title' plus any strategies registered by other keyword libraries Note: This keyword is called automatically from *Open Test Browser* """ locator_manager.register_locators("sf", lex_locators) locator_manager.register_locators("text", "Salesforce.Locate Element by Text") locator_manager.register_locators("title", "Salesforce.Locate Element by Title") # This does the work of actually adding all of the above-registered # location strategies, plus any that were registered by keyword # libraries. locator_manager.add_location_strategies()
def test_register_locators(self): """Verify that register_locators updates the LOCATORS dictionary""" register_locators("test", {"foo": "//div/foo"}) expected = {"test": {"foo": "//div/foo"}} self.assertDictEqual(LOCATORS, expected)
def __init__(self): register_locators("B", locators)