Issue- Fetching and Printing all links of Google Home page

26 views
Skip to first unread message

Pankaj Tiwari

unread,
Dec 4, 2016, 11:06:15 PM12/4/16
to seleniu...@googlegroups.com
Hello Guys,

I am trying to fetch all links of Google page and trying to print in console. Code is giving me 0 result though goolge home page have lots of links. Please check below snap shot of code and result and let me know if am doing something wrong.


Inline image 1

Jim Evans

unread,
Dec 4, 2016, 11:15:12 PM12/4/16
to Selenium Users
You're looking for elements with a tag name "//a". Either use By.tagName("a") or By.xpath("//a"). Don't mix them.

Pankaj Tiwari

unread,
Dec 4, 2016, 11:19:50 PM12/4/16
to seleniu...@googlegroups.com
Thanks Jim, 
I have searched with By.tagName("a") and now its working.. 

Regard's
Pankaj

On Mon, Dec 5, 2016 at 9:45 AM, Jim Evans <james.h....@gmail.com> wrote:
You're looking for elements with a tag name "//a". Either use By.tagName("a") or By.xpath("//a"). Don't mix them.

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/724e2a04-0bb1-4d1f-ac28-855b1d71387d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages