assertElementNotPresent displays error but test passes

3 views
Skip to first unread message

divya

unread,
Sep 19, 2008, 6:02:29 PM9/19/08
to selenium-users...@googlegroups.com
Hi,

I am quite new to Selenium and am using JSelenium. I am trying to do the following action of
a. Delete an element and use asserElementNotPresent function to ensure that the element/ link with a specific text is not present in the page

Page.CONDITIONALFILTER.assertElementNotPresent(\\ "ecfName", "check delete");\\ }

ecfName=xpath=//a[starts-with(text(),'cfName')] is defined in my page elementrepo.properties file

when i run this script (with the link with text cfName not present, the log in maven displays
### check delete [ERROR]
and after this step, the testcase with the step is said to be successful.. is ERROR being returned the correct value?

why would i be seeing the error

when i execute the same thing with cfName link present in the page, i get
### check delete [OK]
test(0) successfull [FAIL]

junit.framework.AssertionFailedError: element for locator('xpath=//a[starts-with\\ (text(),'cfName')]') IS present unexpectedly\\ at junit.framework.Assert.fail(Assert.java:47)\\ at junit.framework.Assert.assertTrue(Assert.java:20)\\ at junit.framework.Assert.assertFalse(Assert.java:34)\\ at com.yahoo.test.jsel.AbstractPage.assertElementPresent(AbstractPage.ja\\ va:339)\\ at com.yahoo.test.jsel.AbstractPage.assertElementNotPresent(AbstractPage\\ .java:328)\\ at com.yahoo.satg.network.qa.ui.framework.ConditionalFilterAction.ass(Co\\ nditionalFilterAction.java:149)\\ at com.yahoo.satg.network.qa.ui.test.smoke.NetworkUI_delCF.testAss(Netwo\\ rkUI_delCF.java:67)\\ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Reply all
Reply to author
Forward
0 new messages