如何单击网页上带有尾随空格字符的链接? [英] How to click on a link with trailing white-space characters on a web page?
本文介绍了如何单击网页上带有尾随空格字符的链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
网页上有这样的链接:
- 概述
- 常规设置
- AR服务器设置
- 缓存设置
- 报告设置
- 网络服务设置
- 日志设置
- 更改密码
我正在用Java eclipse在selenium中编写一个自动化脚本,并想单击缓存设置"选项.有人可以帮忙吗?我知道这很简单,但是我是这个世界的新手.我能够自动执行之前的步骤,直到进入此网页为止,现在只能单击缓存设置".
I am writing an automation script in selenium under Java eclipse and want to click on Cache Settings option. Can some one help? I know this would be simple, but i am a newbie in this world.i am able to automate previous steps til coming to this web page and now stuck in clicking Cache settings.
HTML片段:
<div class="textMainNav">Cache Settings </div>
<div class="textMainNav">Report Settings </div>
我尝试了很少的事情,但是没有任何作用.
I have tried few things but none working.
推荐答案
要单击链接,可以使用以下任一解决方案:
To click on the links you can use either of the following solutons:
-
点击
Overview
:
-
xpath :
driver.findElement(By.xpath("//div[@class='textMainNav' and normalize-space()='Overview']")).click();
这篇关于如何单击网页上带有尾随空格字符的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文