How to check if some text is present on a web page using selenium 2?

automated-tests, python, selenium-webdriver

Solution

For those of you who are still interested:

Generic Solution

if text in driver.page_source:
    # text exists in page

unittest:

assertTrue(text in driver.page_source)

pytest:

assert text in driver.page_source

Problem

Hi I am using selenium to automate test on web pages. I am using selenium 2 and python and would like to have answers in this framework only. SO how do I check whether some text is present or not? I have tried asset equals but it is not working? ``` assertEquals(driver.getPageSource().contains("email"), true); ```

Original source

Related problems