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.

J_F
  • 9,956
  • 2
  • 31
  • 55
  • Have you tried the unicode character [\u0094](http://www.fileformat.info/info/unicode/char/0094/index.htm) (Cancel Character)? Not sure if this is the one. You might want to browse through [these](http://www.ssec.wisc.edu/~tomw/java/unicode.html) in case it isn't. Let me know if this works for you. – JDelorean Oct 21 '16 at 08:43

1 Answers1

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!

Xwris Stoixeia
  • 1,831
  • 21
  • 22