Dashboard > Selenium > ... > Contributed User-Extensions > storeassertXpath
Selenium Log In View a printable version of the current page.
storeassertXpath
Added by François Eric, last edited by Sumith Gamage on Dec 13, 2006  (view change) show comment
Labels: 
hi, this, is, a, good

description

Allows using the storeXpath, assertXpath and verifyXpath.
This allows to get an Xpath evaluation and to store it or to assert on it.

example of use

This will store the number of rows there is in the Person list

storeXpath count(//table[@id='Person-list']/tbody/tr) listCount

This will assert that the number of rows has been incremented by one (after an add for example)

assertXpath count(//table[@id='Person-list']/tbody/tr) javascript{parseInt(storedVars['listCount']) + 1}

notes

To use, simply copy the code in the user-extensions.js in your user-extensions.js

download

store assert xpath command v1_0
store assert xpath command v1_0_8_1

I added a feature request in jira so that this can be added to the source code http://jira.openqa.org/browse/SEL-194

WARNING:
If you are using the latest release (0.7), then you will need to replace isIE with browserVersion.isIE

Also note that you should no longer need to include the code for storeXpath as it will automatically be supported due to the presense of the getter.

This extension no longer works with 0.8.1 - any chance of a new version?

>> This extension no longer works with 0.8.1 - any chance of a new version?

Hope store assert xpath command v1_0_8_1 will sortout this problem.

P.S. All credit goes to the original author. Please note that the update is not approved by the original author yet.

  • Sumith

Thanks for the update - this has got the extension working for Firefox again, but IE is failing with the message 'Object expected'. On inspection I found that the extension uses function addXPathSupport, which is not included with Selenium Core 0.8 (it was previously found in html-xpath-patched.js). Perhaps there is an alternate function to use in 0.8? Anybody have any ideas?

Dave,

I also hit that and searched for a solution. Unfortunately the xpath.js available at \core\xpath\ contains quite different code. I'm afraid this extension is unusable on IE with the present version of Selenium Core.

There is a topic on that here:
http://forums.openqa.org/thread.jspa?messageID=24811&#24811

Am I right in thinking that all anyone really uses this for was counting elements with the count() function? If so, I'm inclined to provide a more limited getXpathCount function that takes in an xpath and tells you how many elements match it. That helps simplify issues with the XPathResult types. See my remarks in http://jira.openqa.org/browse/SEL-194

Hi,
I downloaded a given "store assert xpath command v1_0_8_1" file and stored it on the drive.
Then,in Selenium IDE, I gave a path for user extension of IDE and restarted IDE.
After restarting IDE it showed an error,
"error loading Selenium IDE extensions: ReferenceError: Selenium is not defined".
I am using Selenium IDE 1.0 Beta 2.
Is there any solution for this?
Thanks!

Posted by anand at Jul 23, 2008 01:31
Site running on a free Atlassian Confluence Community License granted to OpenQA. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.6 Build:#812 Aug 06, 2007) - Bug/feature request - Contact Administrators