Search
 
 

Display results as :
 


Rechercher Advanced Search

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Find and click a span element value

View previous topic View next topic Go down

Find and click a span element value

Post by Darknet 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"

Darknet

Posts : 1
Join date : 2016-04-11

Back to top Go down

Re: Find and click a span element value

Post by kishor.meher@outlook.com on Mon Apr 11, 2016 8:39 pm

try following, it must fix your problem.

login = mytv.findElement(By.xpath("//span[text()='Live TV']"));

kishor.meher@outlook.com

Posts : 2
Join date : 2016-04-11

Back to top Go down

Re: Find and click a span element value

Post by murthi 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.

murthi
Active particpant
Active particpant

Posts : 11
Join date : 2016-04-14
Location : Bangalore

Back to top Go down

Re: Find and click a span element value

Post by Sponsored content Today at 7:13 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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