Test Scenario to check if the seat is available or not on Redbus.in Booking system

StackOverflow https://stackoverflow.com/questions/21578952

  •  07-10-2022
  •  | 
  •  

Question

Site: www.redbus.in:

  1. Enter from, To, Date and click on Search Buses
  2. Click on view seat below fare.
  3. A new popup window appears where user can select the seat of their choice.
  4. Here the seats which are already reserved will be disabled.
  5. I want to capture the seats which are available for booking in excel or data table.

Please guide me from step 3 I will write the code for step 1, 2.

Was it helpful?

Solution

Basically you have to check which property is different in 'Available seat' objects and 'Occupied Seat' objects in that pop-up window. In given redbus site, ‘class’ property differentiates them with value 'availableSeat' for not booked seats.

Here below is code for step 3 to 5:

'seats are of object type link, hence creating description object for collection link child objects

Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"

'Here Seatmap is pop-up window which has collection of seats link

Set seatlinks = Browser("Online Bus Booking: Book").Page("Book Ticket - Search Buses").WebElement("Seatmap").ChildObjects(oDesc)

For i = 0 To seatlinks.count - 1  Step 1 
 DataTable.SetCurrentRow(i+1)

If seatlinks(i).GetROProperty("class") = "availableSeat" Then

    DataTable.Value("AvailableSeats","Global") = seatlinks(i).GetROProperty("innertext") & " -Seat Available"

Else

DataTable.Value("AvailableSeats","Global") = seatlinks(i).GetROProperty("innertext") & " -Seat Occupied"
End If

Next

So it will give list of 'Available' and 'Occupied' seats with seat number in your global datatable.

OTHER TIPS

So you want help with only 3rd step.. I guess there is no property or method which can check if the object is enabled or disabled. Please correct me if I am wrong. Your question makes sense as this scenarios can be encountered in any project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top