Java selenium xpath need help

16 views
Skip to first unread message

jlv...@gmail.com

unread,
Sep 27, 2016, 11:31:22 PM9/27/16
to Selenium Users
Hi All,

I am using firefox and Eclipse IDE with selenium but didn't work.

the line below try to click tab#5 from URL
dr1.findElement(By.xpath("//a[contains(@href, '../Preferences/Index')]")).click();

The Inspected Element records when click on this tab showing as below:
css=a.subnavsprite.tab5
//li[@id='TN5']/a
//a[contains(@href, '../Preferences/Index')]
//li[6]/a

Below is the code, could anyone help as I just the beginner.
Thanks so much in advance!


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="ctl00_Head1">
<body class="HomePageBody Gen1 en-us ">
<div class="HomePage">
<div class="PageHeader">
<div class="HomeIcon"> </div>
<div class="LinkTabs">
<div class="LanguagePrefContainer">
<ul class="top-navigation">
<li id="TN0" class="tab active">
<li id="Li1" class="tab">
<li id="TN2" class="tab">
<li id="TN3" class="tab">
<li id="TN4" class="tab">
<li id="TN5" class="tab">
<a class="subnavsprite tab5" href="../Preferences/Index" style="background-color: transparent;"></a>
</li>
<li id="TN8" class="tab nav-sub">
<li class="OwnerCarModol hide-tab"> </li>
<li class="OwnerVIN hide-tab"> </li>
</ul>
</div>
</div>
</div>
<div class="HomePageContainer">
<div id="ContactUsPopUp" style="display : none;">
<div id="ConfirmationErrorBgEnDiv" style="display : none;">
<div id="ImgBtnOkDiv" style="display : none;">
<div id="ConfirmationErrorBgFrDiv" style="display : none;">
<input id="vehicleDeviceType" name="vehicleDeviceType" value="Gen1" type="hidden">
</body>
</html>


Reply all
Reply to author
Forward
0 new messages