VBA登录无法单击按钮

时间:2018-07-23 17:51:03

标签: excel vba

一切正常,直到我尝试单击该按钮。该按钮没有名称,所以我试图按班级获取它。有什么建议吗?

按钮:

<template>
    <div>
        <table class="table table-bordered">
            <thead>
                <th  v-for="c in columns" v-bind:class="[c.className ? c.className : '']" :key="c.code">{{c.label}}</th>
            </thead>
            <tbody>

            <!-- Add the ref attribute to each row -->
            <row v-for="(row, index) in rows"
                 :ref="`myRow${index}`"
                 :index="index+1"
                 :init-data="row"
                 :columns="columns"
                 :key="row.hash"
                 :hash="row.hash"
                 v-on:remove="removeRow(index)"></row>

            </tbody>
        </table>
        <div class="d-flex">
            <table>
                <tr>
                    <td>Unique SKUs:</td>
                    <td>{{rows.length}}</td>
                    <td>Total units:</td>
                    <td>{{totalUnits}}</td>
                </tr>
            </table>
            <span class="flex-fill"></span>
            <button class="btn" @click="newRow">Nueva línea</button>
        </div>
    </div>
</template>

我的代码:

computed: {
        totalUnits: function () {
            for(let (x, index) in this.rows) {
                let row = this.$refs[`myRow${index}`]
                // You now have an instance of the component
                let subtotal = row.getSubtotal()
            }
        }
    },

1 个答案:

答案 0 :(得分:0)

CSS选择器:

尝试使用CSS选择器定位元素。选择器input[value='Sign On'定位到页面上具有input标签的第一个元素,并具有值为value的属性'Sign On'


将选择器应用于VBA:

通过querySelector的{​​{1}}方法应用。

document

您也可以尝试

IE.document.querySelector("input[value='Sign On']").Click

其他观察结果:

没有足够的HTML或URL可以提供更多建议。您可以直接通过以下方式提交表单:

IE.document.querySelector("input[value='Sign On']").FireEvent "onclick"
相关问题