0

I'm doing a test suite in python based on the code provided by selenium and i get strange assertion errors when checking for the actual page like this:

sel.click("link=Overview")
sel.wait_for_page_to_load("30000")
self.assertEqual("Naaya testing - Subtitlu testare", sel.get_title())

sel.click("link=Portal properties")
sel.wait_for_page_to_load("30000")
self.assertEqual("Naaya testing - Subtitlu testare", sel.get_title())
sel.click("link=Metadata")
sel.wait_for_page_to_load("15000")

Strange in this piece of code is that i get the assertion error only at the first occurence in code, after i changed the first occurence with:

title = sel.get_title()
self.failUnless(title == "Naaya testing - Subtitlu testare","nu sunt "
                "pe pagina principala")

i got rid of the error ,but i still don't get why the second assertion does not fail but the first one do ?

1
  • sel = self.selenium sorry i forgot about that Commented Aug 5, 2010 at 12:52

1 Answer 1

2

In python when you use == operator order may make difference. Try "Your strng" == title and check result. Also assertEqual may check type, so correct code will be:

self.assertEqual("Naaya testing - Subtitlu testare", str(sel.get_title()))

or:

self.assertEqual(u"Naaya testing - Subtitlu testare", sel.get_title())

if selenium uses unicode type.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.