Unable to click on a "text" link in google search page

nikhil udgirkar :

I am trying to click on News link on google search page the HTML structure looks like this enter image description here

I tried following xpaths but none worked

//a/child::span[1][contains(.,'News')]

The following xpath resulted in invalid selector: The result of the xpath expression "//a/child::span/following-sibling::text()[contains(.,'News')]" is: [object Text]. It should be an element.

//a/child::span/following-sibling::text()[contains(.,'News')]

Thanks

JaSON :

You simply need

//a[contains(., "News")]

Note that "News" is not a part of span, but a, so your 1st XPath won't work

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Unable to click on a "text" link in google search page

Unable to click any link in the web page

Input text to search box on web page and click Search

Mechanize page.search does not work with link.click method

Unable to click on the Login link at the right hand side of the page using Protractor

Unable to click a link in a table

Unable to click on a link with CasperJS

Google chart : Navigating to other page on click of the node link

Selenium search text in a page section and click on a button inside it

Unable to get the news articles link in google news page using Selenium

how to click a result from google search that is not on first page with selenium java

Puppeteer unable to click on the Allow button in Google consent page

With Python, how to scrape the descriptive text of a link from a Google search?

Click on a link based on text

link to another page not working for when i click on an img but works when i click on a text

Unable to perform a click on a certain link

Unable to open link with jQuery click()

Unable to click a link for certain column

Unable to click link with Selenium in Python

How to click on the second link in google search result list using selenium web driver

Click on text to copy a link to the clipboard

Click on a link beside text in TruClient

Change link text upon click

page by click link in another page in html

How to click on a link using partial link text

PDFBox - How to click a link in a PDF file to move to another page and underline specific text inside it?

How to clear a Text Box in angularJS, when click any link in the page AngularJS

Unable to click on button available on the page

Google translate using a link click