Python selenium.webdriver.common.keys.Keys 模块,DELETE 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用selenium.webdriver.common.keys.Keys.DELETE

项目:robotframework-weblibrary    作者:Netease-AutoTest    | 项目源码 | 文件源码
def _map_ascii_key_code_to_key(self, key_code):
        map = {
            0: Keys.NULL,
            8: Keys.BACK_SPACE,
            9: Keys.TAB,
            10: Keys.RETURN,
            13: Keys.ENTER,
            24: Keys.CANCEL,
            27: Keys.ESCAPE,
            32: Keys.SPACE,
            42: Keys.MULTIPLY,
            43: Keys.ADD,
            44: Keys.SEPARATOR,
            45: Keys.SUBTRACT,
            56: Keys.DECIMAL,
            57: Keys.DIVIDE,
            59: Keys.SEMICOLON,
            61: Keys.EQUALS,
            127: Keys.DELETE
        }
        key = map.get(key_code)
        if key is None:
            key = chr(key_code)
        return key
项目:devsecops-example-helloworld    作者:boozallen    | 项目源码 | 文件源码
def onFail(self, by, value, message, text):
        if message: 
            message = message + ". "
        else:
            message = ""
        if text:
            text = ":" + text
        else:
            text = ""
        self.fail("Failed: {0}{1} {2}".format(message, self.describeElement(by, value), text))


    #def clearKeys(self):
    #    return [ Keys.CONTROL+"a", Keys.DELETE ]
项目:test-automation    作者:openstax    | 项目源码 | 文件源码
def test_admin_set_the_course_scholastic_year_100135(self):
        """Set the course scholastic year.

        Steps:

        Expected Result:
        """
        self.ps.test_updates['name'] = 't1.59.021' \
            + inspect.currentframe().f_code.co_name[4:]
        self.ps.test_updates['tags'] = ['t1', 't1.59', 't1.59.021', '100135']
        self.ps.test_updates['passed'] = False

        # Test steps and verification assertions
        self.admin.wait.until(
            expect.visibility_of_element_located(
                (By.PARTIAL_LINK_TEXT, 'Course Organization')
            )
        ).click()
        self.admin.wait.until(
            expect.visibility_of_element_located(
                (By.PARTIAL_LINK_TEXT, 'Courses')
            )
        ).click()

        # Create the course
        self.admin.find(By.XPATH, "//a[text()='Add Course']").click()
        self.admin.find(
            By.ID, "course_year"
        ).send_keys((Keys.DELETE * 4) + str(datetime.date.today().year))

        self.ps.test_updates['passed'] = True

    # Case C100136 - 022 - Admin | Set the number of sections
项目:test-automation    作者:openstax    | 项目源码 | 文件源码
def test_admin_set_the_number_of_sections_100136(self):
        """Set the number of sections.

        Steps:

        Expected Result:
        """
        self.ps.test_updates['name'] = 't1.59.022' \
            + inspect.currentframe().f_code.co_name[4:]
        self.ps.test_updates['tags'] = ['t1', 't1.59', 't1.59.022', '100136']
        self.ps.test_updates['passed'] = False

        # Test steps and verification assertions
        self.admin.wait.until(
            expect.visibility_of_element_located(
                (By.PARTIAL_LINK_TEXT, 'Course Organization')
            )
        ).click()
        self.admin.wait.until(
            expect.visibility_of_element_located(
                (By.PARTIAL_LINK_TEXT, 'Courses')
            )
        ).click()

        # Create the course
        self.admin.find(By.XPATH, "//a[text()='Add Course']").click()
        self.admin.find(
            By.ID, "course_num_sections"
        ).send_keys((Keys.DELETE) + str(1))

        self.ps.test_updates['passed'] = True

    # Case C100137 - 023 - Admin | Set the course start date and time