Forum Discussion

kkrush's avatar
kkrush
Occasional Contributor
5 years ago
Solved

EvaluateXpath - using keyword test , can we use evaluateXpath.?

I am trying to use keyword test to perform evaluatexpath, but am not able to, as per the below example/code, can we do the same with keyword test? if yes, can you please provide me with the keyword s...
  • AlexKaras's avatar
    AlexKaras
    5 years ago

    Hi,

     

    Thank you for the project.

    Well, I was not able to access your tested site (no navigation error in the browser but the page was just empty), so I replaced it with https://www.potnoodle.com in both, Keyword test and NameMapping.

    Also I changed type of the VarTemp test local variable from String to Object (as it is expected to store a reference to the found web element, but not a string).

    After that I was able to execute keyword test with this line of code for the Run Code Snippet operation:

    Aliases.browser.pageXXXURL.QuerySelector("a.login-to-load.ng-star-inserted");

    (Obviously, the test reported that nothing was found but there was no exception.)

     

    Unfortunately, test failed with the Type Mismatch error when I tried to use .QuerySelectorAll() and store search result to the VarTemp variable. I think this is because .QuerySelectorAll() returns an array and (even empty) array cannot be assigned to the keyword test local variable of either Object or any other built-in type.

    I don't know if it is possible to assign an array that is obtained as the result of the last operation to the keyword test local variable as I am almost do not use keyword testing. Maybe those who use it will be able to provide you with some piece of advice.