Monday, September 21, 2009

Selenium - Verify Element Properties

While doing the automation through selenium we also need to verify the tooltip of the image or it's path(location, URL). selenium has provided API to check the attirbutes of any element. Now let's see how to do this.

let's first see how to do this in selenium. The following script will navigate to Then it will fetch the URL of the profile photo and will open the photo.

storeAttribute //img[@alt='My Photo']@src imagePath
open ${imagePath}

<!-- Purpose:- To show how to verfiy the Properties of a image
Created By:- Gaurang Shah

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="en" lang="en">
<head profile="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>Verify Image Property</title>
<table cellpadding="1" cellspacing="1" border="1">
<tr><td rowspan="1" colspan="3">New Test</td></tr>
<td>//img[@alt='My Photo']@src</td>


Post a Comment