Skip to content
Snippets Groups Projects
test.robot 2.11 KiB
Newer Older
M9713's avatar
M9713 committed
*** Settings ***
Library     SeleniumLibrary
Library     Process
Library     OperatingSystem

*** Keywords ***
Start Chrome
    ${chrome_options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver
    Call Method    ${chrome_options}    add_argument    --no-sandbox
    Create Webdriver    Chrome      chrome_options=${chrome_options}

*** Test Cases ***
Test Firefox
    Open Browser   http://google.com    Firefox
    Title Should Be     Google
    Close Browser

Test Chrome
    Start Chrome
    Go To   http://www.google.com
    Title Should Be     Google
    Close Browser
    
Ping test
    ${result} =     Run Process   ping 127.0.0.1 -c 1   shell=True
    Should Contain   ${result.stdout}     64 bytes from 127.0.0.1:

*** Test Case ***
Aikataulut

    Start Chrome
    Go To        https://www.matkahuolto.fi/
  


    Maximize Browser Window
    title should be     Etusivu - Matkahuolto
    #sleep  5
    #Click Element           //input[@placeholder='Hae']
    #Input Text      //input[@placeholder='Hae']  Helsinki
    click element  //button[normalize-space()='Hyväksy evästeet']
   
    click element    //a[normalize-space()='Hae aikatauluja']
    sleep  5
    click element       //h1[normalize-space()='Osta liput - hae aikataulut']
    press keys  xpath=//body      TAB
    #click element //input[@id='27a2e0bc-b8fa-462c-92c9-6678278726fe-dep']
    press keys     none  h+e+l+s+i+n+k+i+TAB
    sleep  2
    
    
    sleep  2
    press keys      none      T+a+m+p+e+r+e+TAB+TAB+TAB+TAB
 
    #Input Text    //input[@id='477baa88-ed7f-4f3b-d646-faebc05ca97a-dep']  Helsinki
    sleep  2
    click element  //button[normalize-space()='Hae aikatauluja']
    sleep  5
    #click element  //input[@id='477baa88-ed7f-4f3b-d646-faebc05ca97a-arr']
    #Input text     //input[@id='477baa88-ed7f-4f3b-d646-faebc05ca97a-arr'] Tampere
    ${get text}     get text   //div[@data-select-connection-callback='selectConnection(theConnection)']
        
    Log To Console  ${get text}
    #Append to file    testi1.csv    ${get text} 
    
    Close Browser
  
  #END

#${get_text}  Get WebElements  ${NAVIGATION}