Selenium Webdriver中xpath // a和.//a之间的区别是什么?

时间:2016-12-29 13:03:43

标签: xpath selenium-webdriver

以下Selenium xpath

之间有什么区别
.//a[@id="name"]

$("#test").select2({
    ajax: {
        url: "URL",
        dataType: 'json',
        delay: 250,
        data: function(params) {
            return {
                searchTerm: params.term, // search term
                page: params.page
            };
        },
        processResults: function(data, params) {
            var d = [];

            for (var i = data.length - 1; i >= 0; i--) {
              d.push({
                id: data[i].hostname, 
                text: data[i].hostname
              });
            }

            params.page = params.page || 0;
            return {
                results: d,
                pagination: {
                    more: (1 + params.page) < data.totalPages
                }
            };
        },
        cache: true
    },
    allowClear: true,
    escapeMarkup: function(markup) {
        return markup;
    },
    multiple: true,
    maximumSelectionLength: 22,
    placeholder: "Select fruits...",
    templateResult: formatRepo,
    templateSelection: formatRepoSelection
});

function formatRepoSelection(data) {
    return data.text;
}

function formatRepo(data) {
    if (data.loading) return data.text;

    return data.text;
}

在第二个xpath前面添加。(点)有什么用?

先谢谢

0 个答案:

没有答案