selenium 使用VBA时未单击镶边按钮(元素不可见)

lrpiutwd  于 2022-12-13  发布在  其他
关注(0)|答案(1)|浏览(126)

我试图点击这个特定的按钮,但它似乎不工作,有人能帮助我吗?
这是我写的

obj.FindElementByXPath("//button[@class='btn btn-warning waves-effect m-1' and @id='btn-create-beneficiary' and text()=' Create Beneficiary']").Click


<div role="tabpanel" class="tab-pane fade in active" id="benef_tab">
                                        <div class="d-flex m-b-15" style="justify-content: flex-end;">
                                            <button class="btn btn-warning waves-effect m-1" id="btn-create-beneficiary" data-toggle="modal" data-target="#createModal" style=""> Create Beneficiary</button>
                                                                                        <button class="btn btn-success waves-effect m-1" data-action="encoding-complete" style="display: none;"><i class="material-icons">done_all</i> Mark as Completed</button>
                                            <button class="btn btn-warning waves-effect m-1" data-action="return-beneficiaries" data-id="15945" style="display: none;"><i class="material-icons">assignment_return</i> Return For Re-check</button>
                                            <button class="btn bg-teal waves-effect m-1" data-action="undo-completeness" style="display: none;"><i class="material-icons">replay</i> Undo</button>
                                                                                    </div>                                            
                                        <div class="table-responsive">
                                            <div id="benefTable_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer"><div class="dt-buttons"><a class="dt-button buttons-excel buttons-html5 btn bg-pink waves-effect" tabindex="0" aria-controls="benefTable" href="#"><span>Excel Download</span></a></div><div id="benefTable_filter" class="dataTables_filter"><label>Filter Result <small class="text-muted">(ID,NAME)</small>:<input type="search" class="form-control input-sm" placeholder="" aria-controls="benefTable"></label></div><div id="benefTable_processing" class="dataTables_processing" style="display: none;"><div style="display: flex; align-items: center;">
                    <div class="preloader pl-size-xs">
                        <div class="spinner-layer pl-red-grey">
                            <div class="circle-clipper left">
                                <div class="circle"></div>
                            </div>
                            <div class="circle-clipper right">
                                <div class="circle"></div>
                            </div>
                        </div>
                    </div>
vltsax25

vltsax251#

VBA首先,在“引用”工具中设置对Selenium WebDrive的引用...然后执行以下代码:
''*************************************************
将MyButton变暗为Selenium.WebElement
设置我的按钮=按CSS查找对象元素(“#btn-创建受益人”)
MyButton.Click

相关问题