Tuesday, October 7, 2014

Python Basics:

Assigning variable & Concatenating:

x = "Hello"
y = "World!"

x + y
'Hello World!'

String representations

a = "Hello1"

repr(a)
"'Hello1'"

str(a)
'Hello1'

x = 123

str(x)
'123'

rep(a)
'123'


*** Settings ***
Documentation   Testing Website for learning selenium
Library  Selenium2Library
Library  OperatingSystem
Test Setup  open browser  http://adam.goucher.ca/parkcalc/    chrome
Test Teardown  close browser

*** Test Cases ***
Check the parking charges
    Choose start time
    Choose start date
    Choose end time
    Choose end date
    Submit and check the cost

*** Keywords ***
Choose start time
    maximize browser window
    select from list by value  id=Lot    LTG
    input text  id=EntryTime    20:00
    select radio button  EntryTimeAMPM    PM
    click element  xpath=//form/table/tbody/tr[2]/td[2]/font/a/img
    select window    title=Pick a Date

Choose start date
    click element  xpath=//form/table/tbody/tr[1]/td/table/tbody/tr/td[1]/select
    wait until page contains  Su
    select from list by label  name=MonthSelector    October
    click element  xpath=//form/table/tbody/tr[4]/td[7]/font/a

Choose end time
    select window  title=Parking Calculator
    input text  id=ExitTime    22:00
    select radio button  ExitTimeAMPM    PM

Choose end date
    click element  xpath=//form/table/tbody/tr[3]/td[2]/font/a/img
    select window    title=Pick a Date
    click element  xpath=//form/table/tbody/tr[1]/td/table/tbody/tr/td[1]/select
    wait until page contains  Su
    select from list by label  name=MonthSelector    October
    click element  xpath=//form/table/tbody/tr[5]/td[2]/font/a

Submit and check the cost
    select window  title=Parking Calculator
    click element  name=Submit
    ${ATR}=    get text    xpath=//form/table/tbody/tr[4]/td[2]/span[1]/font/b
    should be equal    ${ATR}    $ 28.00


No comments:

Post a Comment