Link

Video recording the Selenium Automation scripts

Its been a long time since I have posted an article, been very busy with work. So, here is an article about video recording the automation scripts that you running.

I have used a third part library called “monte.media” to record the testing. This is done when there are issues. The recorded video is attached to the Jira ticket for the developer to see the steps and also know the issue.

Here are the libraries you need import.
[gist id=5719121]

For the video to work make sure you use both the startRecording and stopRecording methods.

Useful links: http://www.randelshofer.ch/monte/
http://massol.myxwiki.org/xwiki/bin/view/Blog/ScreenRecordingForSelenium2

Solving Compound class names are not supported – error

Here is a simple solution to resolve the error: “Compound class names are not supported. Consider searching for one class name and filtering the results.”.
Say you have a div class something link this – div class=”m-table-rap m-tab-body-rap tab-body-m” and want to use xpath to identify the element you will get the error “Compound class names are not supported. Consider searching for one class name and filtering the results.”
To resolve the issue you will need to use cssSelector
The cssSelector will be “div.m-table-rap.m-tab-body-rap.tab-body-m”
driver.findElement(By.cssSelector("div.m-table-rap.m-tab-body-rap.tab-body-m")

Using type command in advanced selenium webdriver – Actions class

Here is the code that you can use to execute the type command when using Actions class
public void actionType(By by, String value) {
new Actions(driver).moveToElement(
driver.findElement(by)).click().sendKeys(Keys.chord(Keys.CONTROL, "a"), value).perform();
}

This will clear the text field and then add the value you want.
If you want to just clear the exiting text use the following command.
new Actions(driver).moveToElement(
driver.findElement(by)).click().sendKeys(Keys.chord(Keys.CONTROL, "a"), "").perform();

You will need to import org.openqa.selenium.Keys;