问题
There are links like this on a web page:
- Overview
- General Settings
- AR Server Settings
- Cache Settings
- Report Settings
- Web Service Settings
- Log Settings
- Change Password
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 snippet:
<div class="textMainNav">Cache Settings </div>
<div class="textMainNav">Report Settings </div>
I have tried few things but none working.
回答1:
To click on the links you can use either of the following solutons:
Click on
Overview
:xpath:
driver.findElement(By.xpath("//div[@class='textMainNav' and normalize-space()='Overview']")).click();
来源:https://stackoverflow.com/questions/53930154/how-to-click-on-a-link-with-trailing-white-space-characters-on-a-web-page