Using regular expression in Selenium

Here is the xpath I want to use regular expression.
Code with out using regular expression:
Assert.IsTrue(selenium.IsElementPresent(“ctl00_5hh5_g5656_675gffg042f_tbSearch”));
Code using regular expression:
Assert.assertTrue(selenium.isElementPresent(“css=input[id$=’tbSearch’]”));

Alternative is to use contains in the xpath. Here is the example:
//input[contains(@id,’tbSearch’)]

Selenium RC Error – SeleniumException: XHR ERROR

When running the selenium script of a website I got the following error
com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://www.website.com.au/ Response_Code = 400 Error_Message = Bad Request.
The solution was pretty simple. Instead of using the url http://www.website.com.au/ change it to http://website.com.au/. Remove the www.
The reason オンライン カジノ is because there is no 301 re-direct is not setup for the website.
Originally the setup was – setUp(“http://www.website.com.au/”, “*chrome”);
Changed it to – setUp(“http://website.com.au/”, “*chrome”);

The constructor DefaultSelenium(String, String, String, String) is undefined

I was creating a script in Java and wanted to run the script using TestNG and Eclipse. I was getting the following error when running the script.
The constructor DefaultSelenium(String, String, String, String) is undefined
To solve the issue you will have to make change to the setUp method.
My code was something like this selenium = new DefaultSelenium(“localhost”, “4444”, “*iexplore”, “http://www.google.com/”); having 4444 as a string. I then changed the code to selenium = new DefaultSelenium(“localhost”, 4444, “*iexplore”, “http://www.google.com/”);

Selenium function for click

Here is selenium function that you can use when you want to either click on a button or link. I have foud this code very useful and interesting.

public void clickElement(String object, String wait) {
String locator = getValue(object);
if (selenium.IsElementPresent(locator))
{
selenium.Click(locator);
Console.WriteLine("Clicked on " + object);
}
else
{
Console.WriteLine(object + " was not found");
}
waitForPageToLoad(wait);
}

You can write this function in a seperate functions class and then call this function in your test script class by referencing the functions class.

How did this solution work for you? Do you have a better alternative? Feel free to share your thoughts in comments section below.