Here is an example for Python.
def is_text_present (self, string):
if str(string) in self.driver.page_source: return True
else: return False
The issue relating to StaleElementReferenceException when trying to use Selenium 2 SelectByText – selectElementEntity.SelectByText() is resolved in the latest version of Selenium Client Driver – Selenium 2.5.1 drivers (.NET bindings for Selenium, including the RC and WebDriver APIs)
There is no verifyTextPresent in Selenium 2 Webdriver; I have created a function that you use to verify if a particular text is present on a web page. You can change the name of the function to anything you want.
public void verifyTextPresent(String value)
As most of you know there is no getText() function in Selenium 2 C#; I have created a function that you can use to get the text associated with a element/xpath.
public String getText(String xpath)
String x = driver.FindElement(By.XPath(xpath)).Text;
Here is how I have used the getText() function in my test script:
Printing the text assoicated with the xpath “//div[@id='fll']/a“
As most of you already know there is a new version of Selenium – Selenium 2 that was released today http://code.google.com/p/selenium/downloads/list. I have created a new script that you can use to start off using Selenium 2 in C#.
What I have seen is that we dont have to use webdriver.firefoxdriver.dll to run your scripts in Webdriver Selenium 2.
I have given the test script and also a screenshot that shows you the dll files that I have included as Reference
WebDriver’s goal is to provide an API that establishes
• A well-designed standard programming interface for web-app testing.
• Improved consistency between browsers.
• Additional functionality addressing testing problems not well-supported in Selenium 1.0.
The Selenium developers strive to continuously improve Selenium. Integrating WebDriver is another step in that process. The developers of Selenium and of WebDriver felt they could make significant gains for the Open Source test automation community be combining forces and merging their ideas and
technologies. Integrating WebDriver into Selenium is the current result of those efforts.