EXERCITII WizzAir 'pe pagina Wizz Air se da click search fara sa se completeze nimic. 'vom verifica daca apar mesajele de avertizare 'se va efectua click pe butonul search Browser("Official Wizz Air website").Page("Official Wizz Air website").WebButton("Search").Click 'Check that Please add origin and destination is displayed. Browser("Official Wizz Air website").Page("Official Wizz Air website_2").Check CheckPoint("Official Wizz Air website") 'se va efectua click pe tab-ul Flight and Hotel Browser("Official Wizz Air website").Page("Official Wizz Air website").WebButton("Flight & Hotel").Click 'Click pe butonul Search fara a completa nimic Browser("Official Wizz Air website").Page("Official Wizz Air website").Link("Search").Click 'Check that Please select return date is displayed. Browser("Official Wizz Air website").Page("Official Wizz Air website_2").Check CheckPoint("Official Wizz Air website_2") 'click pe tabul Hotels Browser("Official Wizz Air website").Page("Official Wizz Air website").WebButton("Hotels").Click 'click pe tabul Cars Browser("Official Wizz Air website").Page("Official Wizz Air website").WebButton("Cars").Click Browser("Official Wizz Air website").Page("Official Wizz Air website").Frame("Frame").WebButton("Search").Click Browser("Official Wizz Air website").Page("Official Wizz Air website").Frame("Frame").WebElement("Pick up location must").Click 'Check that Pick up location must be specified is displayed. Browser("Official Wizz Air website").Page("Official Wizz Air website_2").Frame("Frame_2").Check CheckPoint("Pick up location must be specified - is displayed") 'Browser("Official Wizz Air website").Page("Official Wizz Air website_2").Frame("Frame_2").Check CheckPoint("Drop off esuat") 'Check that Drop off location must be specified is displayed after Pick up location must be specified. Browser("Official Wizz Air website").Page("Official Wizz Air website_2").Frame("Frame_2").Check CheckPoint("Drop off location must be specified after PickUpLoc") 'Synchronization point is the time interface between Tool and Application under test. Synchronization point is a feature to specify the delay time between two steps of the test script. 'For example, clicking on a link may load the page is 1 second, sometimes 5 seconds or even it may take 10 seconds to load it completely. It depends on various factors such as the application-server response time, network bandwidth, and client system capabilities. 'If the time is varying then the script will fail, unless the tester handles these time differences intelligently. 'Browser("Official Wizz Air website").Page("Official Wizz Air website").Sync 'Browser("Official Wizz Air website").CloseAllTabs 'face click pe flights si verifica sa apara textul cu cookies Browser("Official Wizz Air website").Page("Official Wizz Air website").WebButton("Flights").Click Browser("Official Wizz Air website").Page("Official Wizz Air website_2").Check CheckPoint("Cookie display") Browser("Official Wizz Air website").Page("Official Wizz Air website").WebElement("search-passenger").Click 'xPath = "//*[@id='flight-search']/div/div/div[3]/form/fieldset[2]/div[2]/div[2]/i[1]" 'Bln=IsEmpty(Browser("Official Wizz Air website").Page("Official Wizz Air website").WebElement("identifier:="&xPath).GetROProperty("class")) 'If Bln = True Then 'Msgbox "The object does not exist" 'Else 'Msgbox "The object exist" 'End If 'verifica sa apara adults in momentul in care facem click pe mai mult de 1 pasager Browser("Official Wizz Air website").Page("Official Wizz Air website").WebButton("Flights").Click Browser("Official Wizz Air website").Page("Official Wizz Air website").WebElement("adult").Click Browser("Official Wizz Air website").Page("Official Wizz Air website").WebButton("WebButton").Click Browser("Official Wizz Air website").Page("Official Wizz Air website_2").Check CheckPoint("adults (14+) test") Browser("Official Wizz Air website").Page("Official Wizz Air website").WebButton("OK").Click 'Browser("Official Wizz Air website").Page("Official Wizz Air website").WebButton("WebButton").Click 'Browser("Official Wizz Air website").Page("Official Wizz Air website").WebButton("OK").Click Browser("Official Wizz Air website").Close Exercitii MOBILE.DE 'Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").WebList("mk").Select "#1" 'cerinta este ca mr de elemente sa fie ... 'M=Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").WebList("mk").GetTOProperty("Items count") '1. display url of page url= Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").GetROProperty("url") MsgBox url '2. get image name 'add before image to repository MyWebImage=Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").Image("Clickhere").ToString MsgBox MyWebImage '3. check if one image is visible ' recomandare sa se astepte in momentul in care se incarca greu sa se puna un pas de asteptare -> Wait 15 -> pauza de 15 secunde url= Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").Image("BMW").GetTOProperty("visible") url2= Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").Image("BMW").GetROProperty("visible") 'url=True If url Then MsgBox "Imaginea este afisata complet" else MsgBox "Imagine incompleta" End If '4. numarul imaginilor din site Dim descImage, listImages 'Trebuie create o descriere a acestor elemente cu tag-ul html “img” Set descImage = Description.Create descImage("html tag").value = "IMG" ' vor fi preluate toate imaginile cu descrierea de mai sus Set listImages =Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").ChildObjects(descImage) ' numarul de imagini se obtine astfel MsgBox "S-au gasit: " & listImages.Count & " imagini." '5. Adaugati urmatorul script pentru a verifica si calcula numarul de imagini de tip “link”. Dim descImagea, listImagesa 'Trebuie create o descriere a acestor elemente cu tag-ul html “img” Set descImagea = Description.Create descImagea("image type").value = "Image Link" ' vor fi preluate toate imaginile cu descrierea de mai sus Set listImagesa =Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").ChildObjects(descImagea) MsgBox "S-au gasit: " & listImagesa.Count & " imagini de tip link" '6. scriere in fisier a tuturor linkurilor din pagina Set oDesc = Description.Create oDesc("html tag").Value = "A" Set oLinkCollection = Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").ChildObjects(oDesc) Set Fo = createobject("Scripting.FileSystemObject") Set f = Fo.openTextFile("C:\qtp\abc1.txt",8,true) 'open in write mode For i = 0 To oLinkCollection.Count - 1 f.Write oLinkCollection.Item(i).ToString & vbNewLine Next f.Close Set f = nothing Reporter.ReportEvent micPass, "Scriere fisier","Totul a decurs ok" '7. Verificati daca toate imaginile existente dispun de un atribut “alt” setat 'The required alt attribute specifies an alternate text for an image, if the image cannot be displayed. 'The alt attribute provides alternative information for an image if a user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader). Dim descImage1, listImages1 Dim a 'Trebuie create o descriere a acestor elemente cu tag-ul html “img” Set descImage1 = Description.Create descImage("html tag").value = "IMG" ' vor fi preluate toate imaginile cu descrierea de mai sus Set listImages1 =Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").ChildObjects(descImage) ' numarul de imagini se obtine astfel MsgBox listImages1.Count For i=1 to listImages1.Count a= listImages1.Item(i).GetROProperty("alt") If trim(a & vbnullstring) = vbnullstring Then MsgBox "Nu toate elementele au atributul alt completat" Exit For End If Next '8. verificati cate modele si sub-modele de masini exista in cele doua liste modele=Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").WebList("md").GetTOProperty("Items count") If M=120 Then Reporter.ReportEvent micPass, "Elemente lista marci masini","valoarea este egala cu 120" Else Reporter.ReportEvent micFail, "Elemente lista marci masini","valoarea NU este egala cu 120" End If If modele=311 Then Reporter.ReportEvent 0, "Elemente lista modele masini","valoarea este egala cu 311" Else Reporter.ReportEvent 1, "Elemente lista modele masini","valoarea NU este egala cu 311" End If Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").WebList("mk").Select "#1" Wait(3) Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").WebList("md").Select "C-Klasse" Wait(3) Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").WebList("select").Select "10.000 €" Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").WebList("select_2").Select "2010" Browser("mobile.de – Gebrauchtwagen").Page("mobile.de – Gebrauchtwagen").WebButton("Treffer anzeigen 336 Treffer").Click 'Browser("mobile.de – Gebrauchtwagen").Page("PKW-Suche bei mobile.de").WebList("select").Select "Preis aufsteigend" Wait(10) Browser("mobile.de – Gebrauchtwagen").Page("PKW-Suche bei mobile.de").Check CheckPoint("PKW-Suche bei mobile.de") Browser("mobile.de – Gebrauchtwagen").Page("PKW-Suche bei mobile.de").Check CheckPoint("PKW-Suche bei mobile.de_2")