How to select a text with Selenium Webdriver?

3,622 views
Skip to first unread message

Mayank Srivastava

unread,
Apr 30, 2013, 6:02:04 AM4/30/13
to seleniu...@googlegroups.com
have a application where text "ABC" is there. I need to select ABC and then have to click hyperlink link.

How we can select text "ABC" with webdriver?

Regards,
Mayank
Message has been deleted

ARK Satyanarayana Raju

unread,
Apr 30, 2013, 6:11:05 AM4/30/13
to seleniu...@googlegroups.com
Try it

Object text=wd.findElements(By.Xpath("...")).getText();
System.out.println(text);
wd.findElements(By.Xpath("same above xpath")).click();

On Tuesday, April 30, 2013 3:37:17 PM UTC+5:30, ARK Satyanarayana Raju wrote:
Here ABC is link or normal text.

Kishore Thotapally

unread,
Apr 30, 2013, 6:11:41 AM4/30/13
to seleniu...@googlegroups.com
If you want select the text and click on hyper link we should the use the following code

Driver.finelements(By.Xpath("//a[contains(text(),'ABC')"]).click()

Let me know if any clarifications

Regards,
Kishore


On Tue, Apr 30, 2013 at 3:37 PM, ARK Satyanarayana Raju <rkramakr...@gmail.com> wrote:
Here ABC is link or normal text.


On Tuesday, April 30, 2013 3:32:04 PM UTC+5:30, Mayank Srivastava wrote:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/FRYuMTZISr8J.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ripon Al Wasim

unread,
Apr 30, 2013, 6:13:56 AM4/30/13
to seleniu...@googlegroups.com
If "ABC" is a hyperlink, you don't need to select. You can click directly in WebDriver by using click() method.

br,
ripon



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/QY0hdzGo_AQJ.

Mayank Srivastava

unread,
May 1, 2013, 1:07:06 PM5/1/13
to seleniu...@googlegroups.com
Hi Ripon,

ABC is text not hyperlink.

Regards,
Mayank

Mayank Srivastava

unread,
May 1, 2013, 1:15:08 PM5/1/13
to seleniu...@googlegroups.com
Hi Kishore.

It's not working.

Regards,
Mayank

Mayank Srivastava

unread,
May 1, 2013, 1:16:26 PM5/1/13
to seleniu...@googlegroups.com
Hi ARK,


It's not working.

Regards,
Mayank

tanu sharma

unread,
Sep 3, 2013, 9:10:41 AM9/3/13
to seleniu...@googlegroups.com
Hi,
Pls suggest

how to select the text in webdriver

e.g.

 

I have a sentence

Please call me later.

Now, I want to select the word ‘call’ in this, so how to go about it..

Please call me later.


Pls respond asap

Hanish Jadala

unread,
Sep 3, 2013, 11:17:55 AM9/3/13
to seleniu...@googlegroups.com
After getting total sentence store in a variable and then split that sentence usint .split(" ") you have to store in array and using index you can get that call word


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages