Share
Go down
Darknet
Posts : 2
Join date : 2016-04-11

Find and click a span element value

on Mon Apr 11, 2016 4:32 am
How can ich find a Value of a span element and click.



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

on Mon Apr 11, 2016 8:39 pm
try following, it must fix your problem.

login = mytv.findElement(By.xpath("//span[text()='Live TV']"));
murthi
Active particpant
Active particpant
Posts : 11
Join date : 2016-04-14
Location : Bangalore

Re: Find and click a span element value

on 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.
Sponsored content

Re: Find and click a span element value

Back to top
Permissions in this forum:
You cannot reply to topics in this forum