Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Using the Xpath generator that comes built into OpenScript's editor, I have generated an xpath to select an attribute of a node:

/*[local-name()='test_results']/@tests

However, when pasted into http.solveXPath, I get errors saying that the variable could not be solved. I have confirmed that the result of the previous get is what I think it is, and I used the auto-saved content.txt as input to the generator, but it still isn't working. What else could be wrong?

(The beginning of my XML is:

<?xml version="1.0" encoding="UTF-8"?><test_results hostname="10.0.0.176" tests="2" failures="0" errors="0" timestamp="{ts '2014-01-10 11:15:47'}" time="125"><test_case number="1">

)

ETA: I'm really concerned with why the xpath generator isn't working, but for the sake of argument, I have also tried the following xpath statements to no effect:

/*test_results/@tests
/test_results/@tests
/test_results[@hostname='10.0.0.176']@tests
/test_results[@hostname='10.0.0.176']/@tests
/test_results[@hostname="10.0.0.176"]@tests
/test_results[@hostname="10.0.0.176"]/@tests
share|improve this question

2 Answers 2

Try this. Hope it helps.

The xpath has to start and end within the same entity and local-name doesn't appear to be valid on this line of your xml file.

/test_results[@hostname="10.0.0.176"]@tests
share|improve this answer
    
I'm not sure what the local-name is about, but the generator put it in; "/test_results/@tests" also didn't work –  Yamikuronue Jan 11 at 22:34
    
Try taking away the double quote marks and replace the hyphen for an underscore. –  Django_Tester Jan 11 at 22:38
    
I was using quotes to set off the xpath from the text around it, they weren't in it. The hyphen was a typo –  Yamikuronue Jan 11 at 22:39
    
Have you tried /test_results[@hostname="10.0.0.176"]@tests to see if that solves the issue for you? –  Django_Tester Jan 11 at 22:40
    
Just did. No change. –  Yamikuronue Jan 11 at 22:55
up vote 0 down vote accepted

I filed a support ticket with Oracle, and they confirmed that there appears to be a bug in the XPath generator. We have had a patch from them recently that may have caused this.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.