这是我的java代码。
@TimeIt(key = "click")
private void clickEvent(String uiIdentifierVariableName, boolean retry) throws Exception {
findElement(uiIdentifierVariableName);
WebElement webElement = ensureElementClickable(uiIdentifierVariableName);
webElement.click(
}
字符串
这是我的html内容
<div _ngcontent-akc-c53="" class="nav ng-star-inserted is-mobile" bis_skin_checked="1" style="border-color: rgb(194, 204, 216);">
<div _ngcontent-akc-c53="" class="mobile-side-nav ng-star-inserted" bis_skin_checked="1">
<div _ngcontent-akc-c53="" class="side-container-bg ng-star-inserted" bis_skin_checked="1" style="display: block;"></div>
<div _ngcontent-akc-c53="" id="mySidenav" class="side-container ng-star-inserted" bis_skin_checked="1" style="width: 185px;">
<div _ngcontent-akc-c53="" class="responsive-side-background ng-star-inserted" bis_skin_checked="1"></div>
<!---->
<a _ngcontent-akc-c53="" class="menu-item ng-star-inserted" style="border-color: rgb(194, 204, 216);">
<div _ngcontent-akc-c53="" class="icon search_icon" bis_skin_checked="1"></div>
<span _ngcontent-akc-c53="" class="text"> Search </span><!---->
</a>
<!----><!---->
<a _ngcontent-akc-c53="" class="menu-item active ng-star-inserted" style="border-color: rgb(194, 204, 216);">
<div _ngcontent-akc-c53="" class="icon home_icon active" bis_skin_checked="1"></div>
<span _ngcontent-akc-c53="" class="text"> Home </span>
<div _ngcontent-akc-c53="" class="nav__selected-item-triangle ng-star-inserted" bis_skin_checked="1" style="background-position: left 0% center;"></div>
<!---->
</a>
<!----><!---->
<a _ngcontent-akc-c53="" class="menu-item ng-star-inserted" style="border-color: rgb(194, 204, 216);">
<div _ngcontent-akc-c53="" class="icon movie_icon" bis_skin_checked="1"></div>
<span _ngcontent-akc-c53="" class="text"> Movies </span><!---->
</a>
<!----><!---->
<a _ngcontent-akc-c53="" class="menu-item ng-star-inserted" style="border-color: rgb(194, 204, 216);">
<div _ngcontent-akc-c53="" class="icon live_icon" bis_skin_checked="1"></div>
<span _ngcontent-akc-c53="" class="text"> Live Channels </span><!---->
</a>
<!----><!---->
<a _ngcontent-akc-c53="" class="menu-item ng-star-inserted" style="border-color: rgb(194, 204, 216);">
<div _ngcontent-akc-c53="" class="icon stories_icon" bis_skin_checked="1"></div>
<span _ngcontent-akc-c53="" class="text"> Stories </span><!---->
</a>
<!----><!---->
<a _ngcontent-akc-c53="" class="menu-item ng-star-inserted" style="border-color: rgb(194, 204, 216);">
<div _ngcontent-akc-c53="" class="icon kids_icon" bis_skin_checked="1"></div>
<span _ngcontent-akc-c53="" class="text"> Kids </span><!---->
</a>
<!----><!----><!----><!---->
</div>
<div _ngcontent-akc-c53="" class="mobile-toggle ng-star-inserted" bis_skin_checked="1">
<div _ngcontent-akc-c53="" id="hamburger" class="hamburger-icon change" bis_skin_checked="1">
<div _ngcontent-akc-c53="" class="bar1 mobile" bis_skin_checked="1"></div>
<div _ngcontent-akc-c53="" class="bar2 mobile" bis_skin_checked="1"></div>
<div _ngcontent-akc-c53="" class="bar3 mobile" bis_skin_checked="1"></div>
</div>
<div _ngcontent-akc-c53="" class="home_icon hover icon" bis_skin_checked="1" style="opacity: 1;"></div>
</div>
<!---->
</div>
<!----><!---->
<div _ngcontent-akc-c53="" class="right-container" bis_skin_checked="1">
<!---->
<a _ngcontent-akc-c53="" class="menu-item menu-item__profile ng-star-inserted">
<div _ngcontent-akc-c53="" class="icon profile_icon" bis_skin_checked="1"></div>
<span _ngcontent-akc-c53="" class="text menu-item__profile-text">Profiles</span>
</a>
<!---->
</div>
</div>
型
当我在//span[contains(text(),'Search')]中传递这个xPath时,现在单击导航栏就会打开它。
我的测试用例得到通过和appium日志也我可以看到这是可点击的.但实际上我无法导航到搜索按钮.什么可能是可能的问题.甚至没有搜索整个导航弹出窗口只有我不能点击.当我使用浏览器堆栈.这个问题是发生在iOS的webview Safari浏览器.同样的事情是在Android Chrome. s工作正常
1条答案
按热度按时间bwitn5fc1#
字符串
private void clickEvent(String uiIdentifierVariableName,boolean retry)throws Exception {
型
}
也许你在webelement.click()中漏掉了结束语;