- Darknet
- Posts : 3
Join date : 2016-04-11
Find and click a span element value
Mon Apr 11, 2016 4:32 am
How can ich find a Value of a span element and click.
How can i say LiveTV click.
Normally i use these Code:
login = mytv.findElement(By.id("loginButton"));
But there i cant say "find Element by LiveTV"
- Code:
<a >
<span class="right-tab">
<span class="left-tab">LiveTv</span>
</span>
</a>
How can i say LiveTV click.
Normally i use these Code:
login = mytv.findElement(By.id("loginButton"));
But there i cant say "find Element by LiveTV"
- kishor.meher@outlook.com
- Posts : 2
Join date : 2016-04-11
Re: Find and click a span element value
Mon Apr 11, 2016 8:39 pm
try following, it must fix your problem.
login = mytv.findElement(By.xpath("//span[text()='Live TV']"));
login = mytv.findElement(By.xpath("//span[text()='Live TV']"));
- murthiActive particpant
- Posts : 11
Join date : 2016-04-14
Location : Bangalore
Re: Find and click a span element value
Thu Apr 14, 2016 8:23 pm
You can use the following way,
1. driver.findElement(By.LinkText("LiveTV")).click();
2. List lstWE=driver.findElement(By.className("left-tab"));
for(WebElement ele:lstWE){
if(ele.getText().equals("LiveTV")
ele.click();
break;
}
}
3. As mentioned in the previous post.
1. driver.findElement(By.LinkText("LiveTV")).click();
2. List
for(WebElement ele:lstWE){
if(ele.getText().equals("LiveTV")
ele.click();
break;
}
}
3. As mentioned in the previous post.
Permissions in this forum:
You cannot reply to topics in this forum