How to get text (Title) from multiple links?

View: New views
2 Messages — Rating Filter:   Alert me  

How to get text (Title) from multiple links?

by dkharod :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have the following HTML and want to know how to get titles for all links that has class="something" (not ALL links on the page):

...A class=linkClassName title="">People Search</A...
...A class=linkClassName title="">Link 1</A...
...A class=linkClassName title="">Link 2</A...
...A class=linkClassName title="">Link 3</A...

I want to get all link texts i.e. "People Search", "Link 1", "Link 2" and "Link 3". I am using Selenium for .NET

Thanks.

Re: How to get text (Title) from multiple links?

by Karl55 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The only way I know to solve that is to use the getHtmlSource() method and then parse all the HTML code to get what you want. It's not the fastest but it should solve your problem.


dkharod wrote:
Hi,

I have the following HTML and want to know how to get titles for all links that has class="something" (not ALL links on the page):

...A class=linkClassName title="">People Search</A...
...A class=linkClassName title="">Link 1</A...
...A class=linkClassName title="">Link 2</A...
...A class=linkClassName title="">Link 3</A...

I want to get all link texts i.e. "People Search", "Link 1", "Link 2" and "Link 3". I am using Selenium for .NET

Thanks.