| Test XPath Locators |
||
| open | ../tests/html/test_locators.html | |
| verifyText | xpath=//a | this is the first element |
| verifyText | xpath=//a[@class='a2'] | this is the second element |
| verifyText | xpath=//*[@class='a2'] | this is the second element |
| verifyText | xpath=//a[2] | this is the second element |
| verifyText | xpath=//a[position()=2] | this is the second element |
| verifyElementNotPresent | xpath=//a[@href='foo'] | |
| verifyAttribute | xpath=//a[contains(@href,'#id1')]/@class | a1 |
SEL-165: search for text w/ and w/out nbsp: "this is the second element" and "this is the second element"
| verifyElementPresent | xpath=//a[text()="this is the${nbsp}third element"] |
| verifyText | //a | this is the first element |
| verifyAttribute | //a[contains(@href,'#id1')]/@class | a1 |
| verifyText | xpath=(//table[@class='stylee'])//th[text()='theHeaderText']/../td | theCellText |
| click | //input[@name='name2' and @value='yes'] | |
| test for SEL-242 | ||
| verifyElementPresent | xpath=//*[text()="right"] | |
| test for SEL-444 | ||
| verifyValue | xpath=//div[@id='nested1']/div[1]//input[2] | nested3b |
| test for SEL-486 and assignId | ||
| verifyValue | xpath=id('nested1')/div[1]//input[2] | nested3b |
| verifyValue | xpath=id('anotherNested')//div[contains(@id, 'useful')]//input | winner |
| assignId | xpath=//*[text()="right"] | rightButton |
| verifyElementPresent | rightButton | |
| xpath counting | ||
| verifyXpathCount | id('nested1')/div[1]//input | 2 |
| verifyXpathCount | //div[@id='nonexistent'] | 0 |
| test for SEL-347 | ||
| verifyElementPresent | xpath=//a[@href="javascript:doFoo('a', 'b')"] | |
| test for SEL-492 | ||
| verifyElementNotPresent | xpath=id('foo')//applet | |
| assertErrorOnNext | Invalid xpath: * | |
| verifyElementPresent | xpath=//a[ | |
Test toggling of ignoreAttributesWithoutValue. The test must be performed using the non-native ajaxslt engine. After the test, native xpaths are re-enabled.
| allowNativeXpath | false | |
| ignoreAttributesWithoutValue | false | |
| verifyXpathCount | //div[@id='ignore']/a[@class] | 2 |
| verifyText | //div[@id='ignore']/a[@class][1] | over the rainbow |
| verifyText | //div[@id='ignore']/a[@class][2] | skies are blue |
| verifyXpathCount | //div[@id='ignore']/a[@class=''] | 1 |
| verifyText | //div[@id='ignore']/a[@class=''] | skies are blue |
| ignoreAttributesWithoutValue | true | |
| verifyXpathCount | //div[@id='ignore']/a[@class] | 1 |
| verifyText | //div[@id='ignore']/a[@class] | over the rainbow |
| verifyXpathCount | //div[@id='ignore']/a[@class=''] | 0 |
| allowNativeXpath | true |