0
result <- z$findElement(using = 'xpath',"//*[contains(text(),'the deal” of hosting major sporting')]")  

In above command the reference String have special character the deal” so ,R gave the Error as

Error: Summary: NoSuchElement
Detail: An element could not be located on the page using the given search parameters.
class: org.openqa.selenium.NoSuchElementException but the reference element found in the particular URL.

1
  • Have you tried the unicode character \u0094 (Cancel Character)? Not sure if this is the one. You might want to browse through these in case it isn't. Let me know if this works for you. Commented Oct 21, 2016 at 8:43

1 Answer 1

1

I think the issue is with your syntax of 'contains' and the use of double quotes. Check here below the correct syntax:

[text()[contains(.,'the deal of hosting major sporting')]]

also the error you are getting means that the element wasn't present at the time of checking. This can occur for a number of reasons.Two of the most common are: 1) you checked too early (i.e. a wait should be introduced instead of a delay).

wait.until(ExpectedConditions.elementToBeClickable(By.id<locator>));

2) Your xpath is wrong (most likely). Noticed you are using //* which means any node so as far as we know, you could be pointing to multiple elements. If you want a more specific xpath answer please post a screenshot with the html code of element you are trying to locate. But I'll take an educated guess on the below:

(your way improved without the ")

findElement(using = 'xpath',"//*[contains(text(),'the deal of hosting major sporting')]");

and if that does not work, go for this:

findElement(using = 'xpath',"//*[text()[contains(.,'the deal of hosting major sporting')]]");

Best of luck!

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for reply,the web page contain the content with ** "**

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.