Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
Darknet
Posts : 3
Join date : 2016-04-11

Find and click a span element value Empty 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.



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"
avatar
kishor.meher@outlook.com
Posts : 2
Join date : 2016-04-11

Find and click a span element value Empty 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']"));
avatar
murthi
Active particpant
Active particpant
Posts : 11
Join date : 2016-04-14
Location : Bangalore

Find and click a span element value Empty 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.
Sponsored content

Find and click a span element value Empty Re: Find and click a span element value

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