Saturday, April 20, 2013

IRCTC Quick Book using Selenium IDE

       Irctc quick book is useful when you want to book tickets for a known train number. The code seen below helps you get rid of retyping the data in case you have to replan your schedule or you are logged out unexpectdly.

If you are looking to book Irctc Tatkal tickets then refer to my previous post "How to book IRCTC tatkal tickets using Selenium IDE?".

We will now see the commands for Quick Book.



This is how source HTML looks:


--------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://www.irctc.co.in/" />
<title>QuickBooking</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">QuickBooking</td></tr>
</thead><tbody>
<tr>
    <td>clickAndWait</td>
    <td>id=quickBookID43</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>name=stationFrom</td>
    <td>sc</td>
</tr>
<tr>
    <td>type</td>
    <td>name=stationTo</td>
    <td>ngp</td>
</tr>
<tr>
    <td>click</td>
    <td>id=calendar_icon1</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>link=26</td>
    <td></td>
</tr>
<tr>
    <td>select</td>
    <td>name=classCode</td>
    <td>label=Sleeper Class(SL)</td>
</tr>
<tr>
    <td>type</td>
    <td>name=trainNo</td>
    <td>12723</td>
</tr>
<tr>
    <td>type</td>
    <td>name=passengers[0].passengerName</td>
    <td>McKiran</td>
</tr>
<tr>
    <td>type</td>
    <td>name=passengers[0].passengerAge</td>
    <td>28</td>
</tr>
<tr>
    <td>select</td>
    <td>name=passengers[0].passengerSex</td>
    <td>label=Male</td>
</tr>
<tr>
    <td>select</td>
    <td>name=passengers[0].berthPreffer</td>
    <td>label=Lower</td>
</tr>
<tr>
    <td>click</td>
    <td>name=upgradeCh</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>name=mobileNumber</td>
    <td>9999999999</td>
</tr>
<tr>
    <td>select</td>
    <td>name=gatewayID</td>
    <td>label=HDFC Bank</td>
</tr>
</tbody></table>
</body>
</html>

--------------------------------

1 comment:

  1. Thanks for posting the full details,its really a good information
    pnr status

    ReplyDelete