如何检测硒元素的变化?

时间:2016-08-12 06:44:56

标签: java selenium

我想要完成的是首先检测div(ng-repeat)列表中的更改,这是搜索查询的结果并单击第一个结果,但我的问题是click事件已经触发并选择已经列出的项目必须是搜索的结果

搜索活动

 driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
 driver.findElement(By.xpath("//*[@id='bs-example-navbar-collapse-1']/ul[2]/li[1]/div/input")).sendKeys(fname);

点击活动

 WebDriverWait dList = new WebDriverWait(driver, 10);
        dList.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"top-menu-members\"]/div[1]/div")));

这是div列表



<div class="list cursor-pointer ng-scope" ng-mouseenter="memberEntered(member)" ng-mouseleave="memberLeft(member)" ng-repeat="member in (members | orderBy:['-new','firstname'])" ng-hide="member.id == user.id" ng-init="member.name = member.firstname + ' ' + member.lastname;" ng-if="members.length">
                                        <div class="settings pull-left blue" ng-click="selectMemberSubmenu(member); moveSubmenu($event, 2);">
                                            <a href="#" ng-class="{ 'open': member.id == selectedMember.id }">
                                                <i class="fa fa-caret-left" aria-hidden="true"></i>
                                            </a>
                                        </div>
                                        <a ui-sref="members.task({ id: member.id })" ng-click="markAsSeen('member', member, $event, false)" href="/members/7E1C4A77-C29A-4121-B305-8766340F4DDA">
                                            <div class="profpic members pull-left">
                                                <div class="bg-image" style="background-image: url(/img/avatar-man.png)"></div>
                                            </div>
                                            <div class="info pull-left">
                                                <p class="pull-left ng-binding">Kyben Jal</p>
                                                <p class="pull-left role ng-binding">Company Manager</p>
                                            </div>
                                            <!-- ngIf: member.new --><div class="member-circle pull-right ng-scope" ng-if="member.new" ng-click="markAsSeen('member', member, $event)">
                                                <img src="/img/notif.png">
                                            </div><!-- end ngIf: member.new -->
                                        </a>
                                    </div>
&#13;
&#13;
&#13;

0 个答案:

没有答案