Selenium adalah FrameWork testing web application yang portable, menyediakan tool record/playback untuk authoring test tanpa belajar bahasa pemrograman.
Download Selenium yang saya gunakan di Sini
1. Selenium IDE ( Integrate Development Environment )
Definisi : Plugin firefox yang melakukan record dan pemutaran interaksi dengan browser.
Fungsi :
- Membuat script sederhana
- Membantu dalam pengujian Eksplorasi
- Mengekspor Remote Control / Script WebDriver
Selenese adalah seperangkat perintah yang menjalankan test Anda sebuah urutan perintah adalah script test
- Action adalah Perintah yang umumnya memanipulasi keadaan aplikasi
- Accessors adalah Memeriksa keadaan aplikasi dan menyimpan hasil dalam variable
- Assertions adalah penegasan : Sama seperti Accessors, tetapi mereka menverifikasi bahwa keadaan aplikasi sesuai dengan apa yang diharapkan.
- Assert ----- contoh : assertText
- Verify ----- contoh : verifyText
- WaitFor --- contoh : WaitForText
- Kolom pertama : Mengidentifikasi Perintah Selenium
- Kolom kedua : Target
- Kolom ketiga : Nilai
* Locating By Identifier
Bila ada script HTML seperti :
<html>
<body>
<form id="LoginForm">
<input name="username" type="text" />
<input name="password" type="password" />
<input name="continue" type="submit" value="login" />
</form>
</body>
</html>
- Identifier = LoginForm (3)
- Identifier = password (5)
- Identifier = continue (6)
- continue (6)
Merujuk pada file html di atas :
- Id = LoginForm (3)
- Id = username (4)
- Id = password (5)
* Locating By Name
Merujuk pada file html diatas :
- Name = username (4)
- Name = continue value = clear (7)
- = name = continue clear (7)
- Name = continue type = button (7)
XPath adalah bahasa yang digunakan untuk mencari node dalam document XLM.
- xpath=/html/body/form[1] (3) - Absolute path (would break if the HTML was changed only slightly)
- //form[1] (3) - First form element in the HTML
- xpath=//form[@id='loginForm'] (3) - The form element with attribute named ‘id’ and the value ‘loginForm’
- xpath=//form[input/@name='username'] (3) - First form element with an input child element with attribute named ‘name’ and the value ‘username’
- //input[@name='username'] (4) - First input element with attribute named ‘name’ and the value ‘username’
- //form[@id='loginForm']/input[1] (4) - First input child element of the form element with attribute named ‘id’ and the value ‘loginForm’
- //input[@name='continue'][@type='button'] (7) - Input with attribute named ‘name’ and the value ‘continue’ and attribute named ‘type’ and the value ‘button’
- //form[@id='loginForm']/input[4] (7) - Fourth input child element of the form element with attribute named ‘id’ and value ‘loginForm’
<html> <body> <p>Are you sure you want to do this?</p> <a href="continue.html">Continue</a> <a href="cancel.html">Cancel</a> </body> <html>
- link=Continue (4)
- link=Cancel (5)
Dom merupakan document html dan dapat diakses dengan menggunakan JavaScript
<html> <body> <form id="loginForm"> <input name="username" type="text" /> <input name="password" type="password" /> <input name="continue" type="submit" value="Login" /> <input name="continue" type="button" value="Clear" /> </form> </body> <html>
- dom=document.getElementById('loginForm') (3)
- dom=document.forms['loginForm'] (3)
- dom=document.forms[0] (3)
- document.forms[0].username (4)
- document.forms[0].elements['username'] (4)
- document.forms[0].elements[0] (4)
- document.forms[0].elements[3] (7)
<html> <body> <form id="loginForm"> <input class="required" name="username" type="text" /> <input class="required passfield" name="password" type="password" /> <input name="continue" type="submit" value="Login" /> <input name="continue" type="button" value="Clear" /> </form> </body> <html>
- css=form#loginForm (3)
- css=input[name="username"] (4)
- css=input.required[type="text"] (4)
- css=input.passfield (5)
- css=#loginForm input[type="button"] (4)
- css=#loginForm input:nth-child(2) (5)
Sekian dulu artikel yang bisa saya share ke teman-teman, Selanjutnya akan saya share adalah Bagaimana cara mengistal Selenium Ide dan Bagaimana Cara menjalankannya , Tunggu ya !
Terima Kasih .