SyntaxError: Failed to execute 'evaluate' on 'Document' error passing parameter as xpath?

Majki

I am trying to pass an xpath as a parameter(redirectButton):

WebElement zoomLogo = driver.findElement(By.xpath(redirectButton));

Line in testsuite.xml looks like this:

            <parameter name="redirectButton" 
        value="&quot;//img[@alt='zoom logo colour long']&quot;)" />

But when I try to run the test through the testsuite file using testng it shows the following error:

SyntaxError: Failed to execute 'evaluate' on 'Document': The string '"//img[@alt='zoom logo colour long']")' is not a valid XPath expression.

I am sure I have proper xpath because when I paste it directly into the code then everything works fine, but when I try to do it via parameter its not working.

Is it possible to do it by parameters?

DebanjanB

This error message...

SyntaxError: Failed to execute 'evaluate' on 'Document': The string '"//img[@alt='zoom logo colour long']")' is not a valid XPath expression.

...implies that the which you have used was not a valid XPath expression.

Seems you were almost there. You need to remove the two &quot; characters and the extra ) to make it a valid xpath expression as follows:

<parameter name="redirectButton" value="//img[@alt='zoom logo colour long']" />

References

You can find a couple of relevant detailed discussions in:

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

XPath Error in Mink: Failed to execute 'evaluate' on 'Document': The result is not a node set, and therefore cannot be converted to the desired type

From Dev

Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document'

From Dev

SyntaxError: Failed to execute 'querySelector' on 'Document': '[object HTMLDocument]' is not a valid selector

From Dev

SyntaxError: Failed to execute 'querySelector' on 'Document': '[object HTMLDocument]' is not a valid selector

From Dev

Passing ROWTYPE parameter on EXECUTE

From Dev

Passing Document as a parameter to xslt

From Dev

Failed to execute 'write' on 'Document' error in loading angular google map

From Dev

Error in xpath compile evaluate query

From Dev

Getting an error: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

From Dev

polymer breaks document.evaluate (xpath)

From Dev

document.evaluate to evaluate Xpath on HTML produced in-browser by XSLT

From Dev

EchoSign - Failed to execute 'write' on 'Document'?

From Dev

Error passing ContainerInterface as a parameter

From Dev

Leaflet.markercluster onclick error - Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

From Dev

Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node' error on append tr to a table

From Dev

Javascript error: Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'

From Dev

Error: Failed to execute 'insertBefore' on 'Node'

From Dev

DataTables error 'Failed to execute appendChild()'

From Dev

Failed: error processing document in mongoimport

From Dev

Error when passing null parameter

From Dev

Swift: error passing self as inout parameter parameter

From Dev

Swift: error passing self as inout parameter parameter

From Dev

Evince Document Viewer - Failed to execute child process "nemo" (Permission denied)

From Dev

Can't Use Polymer Element - "Failed to execute 'registerElement' on 'Document'"

From Dev

Evince Document Viewer - Failed to execute child process "nemo" (Permission denied)

From Dev

C++ Passing a Function as a parameter, to execute at a certain point

From Dev

Getting Error - Failed to Read Schema Document - JBPM

From Dev

Spring Context error Failed to read schema document

From Dev

How to pass DOM Document created using Axiom to evaluate XPath in Psychopath processor

Related Related

  1. 1

    XPath Error in Mink: Failed to execute 'evaluate' on 'Document': The result is not a node set, and therefore cannot be converted to the desired type

  2. 2

    Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document'

  3. 3

    SyntaxError: Failed to execute 'querySelector' on 'Document': '[object HTMLDocument]' is not a valid selector

  4. 4

    SyntaxError: Failed to execute 'querySelector' on 'Document': '[object HTMLDocument]' is not a valid selector

  5. 5

    Passing ROWTYPE parameter on EXECUTE

  6. 6

    Passing Document as a parameter to xslt

  7. 7

    Failed to execute 'write' on 'Document' error in loading angular google map

  8. 8

    Error in xpath compile evaluate query

  9. 9

    Getting an error: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

  10. 10

    polymer breaks document.evaluate (xpath)

  11. 11

    document.evaluate to evaluate Xpath on HTML produced in-browser by XSLT

  12. 12

    EchoSign - Failed to execute 'write' on 'Document'?

  13. 13

    Error passing ContainerInterface as a parameter

  14. 14

    Leaflet.markercluster onclick error - Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

  15. 15

    Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node' error on append tr to a table

  16. 16

    Javascript error: Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'

  17. 17

    Error: Failed to execute 'insertBefore' on 'Node'

  18. 18

    DataTables error 'Failed to execute appendChild()'

  19. 19

    Failed: error processing document in mongoimport

  20. 20

    Error when passing null parameter

  21. 21

    Swift: error passing self as inout parameter parameter

  22. 22

    Swift: error passing self as inout parameter parameter

  23. 23

    Evince Document Viewer - Failed to execute child process "nemo" (Permission denied)

  24. 24

    Can't Use Polymer Element - "Failed to execute 'registerElement' on 'Document'"

  25. 25

    Evince Document Viewer - Failed to execute child process "nemo" (Permission denied)

  26. 26

    C++ Passing a Function as a parameter, to execute at a certain point

  27. 27

    Getting Error - Failed to Read Schema Document - JBPM

  28. 28

    Spring Context error Failed to read schema document

  29. 29

    How to pass DOM Document created using Axiom to evaluate XPath in Psychopath processor

HotTag

Archive