Issue with XPath in 'Negative-news' bot

Hi
I would like to run negative-news-search-bot on Chrome.
IE is the following with X-path specification of # 9.
//*[@id=“rso”]/div[1]/div/div[1]/div/div/div[1]/a

I tried X-path on chrome, but it does not work.
Please tell me the X-path on Chrome

Hi @tamotsu_itoieq in the example above, the Xpath in step 9 is different - it is //*[@id=“rso”]//div[@class=‘r’]/a[1]. It works correctly in Chrome.

Hi
Thank you for your reply.
Is X-path at chrome //*[@id=“rso”]//div[@class=‘r’]/a[1] ?
Processing will stop with the following error

Caused by: org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression //[@id=“rso”]//div[@class=‘r’]/a[1] because of the following error:
SyntaxError: Failed to execute ‘evaluate’ on ‘Document’: The string '//
[@id=“rso”]//div[@class=‘r’]/a[1]’ is not a valid XPath expression.

It will work with the X-Path below, but I get only one result.
//*[@id=“rso”]/div[1]/div/div[1]/div/div/div[1]/a[1]

@tamotsu_itoieq Can you share the screenshot of the web element action that fails with this error?

Hi
It seems that it was my misunderstanding.

It worked without problem in the lower X-Path
//*[@id=“rso”]//div[@class=‘r’]/a[1]

Thank you

1 Like