Enroll Now
Classroom Training - 9739216095, Corporate Training - 9590587663

Porto

Selenium IDE Questions & Answers-Part 2

***Part 2***

For previous Top 25 Selenium Interview Question & Answers

1. I want to generate random numbers, dates as my test data, how do I do this in Selenium IDE?

Answer

This can be achieved by executing java script in Selenium. Java script can be executed using following syntax –

 

type

css=input#s

javascript{Math.random()}

 

And for date –

 

type

css=input#s

javascript{new Date()}

 

2. Can I store result of an evaluation and use it later in my test?

Answer

You can use “store” command to achieve this. You can save result of an evaluation in a variable and use it later in your Selenium IDE script. For example we can store value from a text box as following, and later use it to type it in another text box –

storeText

css=input#s

var1

type

css=input#d

${var1}

 

3. I have stored result of an evaluation; can I print it in IDE to check its value?

Answer

You can use echo command as following to check the stored value in Selenium IDE –

 

storeText

css=input#s

var1

echo

${var1}

 

4. Can I handle java script alert using Selenium?

Answer

You could use verify/assertAlert to check presence of alert on page. Since selenium cannot click on “Ok” button on js alert window, the alert itself does not appear on page when this check is carried out.

 

5. Selenium has recorded my test using XPath, how do I change them to css locator?

Answer

You can use drop down available next to Find in Selenium to change element locator used by Selenium –

 

6. I have written my own element locator, how do I test it?

Answer

You can use Find button of Selenium IDE to test your locator. Once you click on it, you would see element being highlighted on screen provided your element locator is right Else one error message would be displayed in log window.

 

7. I have written one js extension; can I plug it in Selenium and use it?

Answer

You could specify you js extension in “Options” window of Selenium IDE –

 

8. How do I convert my Selenium IDE tests from Selenese to another language?

Answer

You could use Format option of Selenium IDE to convert tests in another programming language –

 

9. I have converted my Selenium IDE tests to java but I am not able to execute themL, execution options as well as Table tab of Selenium IDE is disabledLL

Answer

This is because Selenium IDE does not support execution of test in any other language than Selenese (language of Selenium IDE). You can convert Selenium IDE in a language of your choice and then use Selenium 1.0 to execute these tests in that language.

 

10. I want to use only Selenese as my test script language but still want to execute tests in other browsers, how do I do that?

Answer

You can execute you Selenese test in another browser by specifying the “-htmlSuite” followed by path of your Selenese suite while starting the Selenium Server. Selenium Server would be covered in details in question about Selenium RC.

 

11. I have added one command in middle of list of commands, how do I test only this new command?

Answer

You can double click on newly added command and Selenium IDE would execute only that command in browser.

 

12. Can I make Selenium IDE tests begin test execution from a certain command and not from the very first command?

Answer

You could set a command as “start” command from context menu. When a command is set as start command then a small green symbol appears before command. Same context menu can be used to toggle this optio

 

13. Are there other tools available outside Selenium IDE to help me tests my element locators

Answer

You could XPath checker – https://addons.mozilla.org/en-US/firefox/addon/xpath-checker/  to test you XPath locators and Firefinder (a firebug add on) to test you css locators –

https://addons.mozilla.org/en-US/firefox/addon/firefinder-for-firebug/

Firefinder can also be used to test XPath locators.

 

14. What is upcoming advancement in Selenium IDE?

Answer

The latest advancement in Selenium IDE would be to have capabilities of converting Selenium IDE tests in Webdriver (Selenium 2.0) options. This would help generating quick and dirty tests for Selenium 2.0

 

15. How can I use looping option (flow control) is Selenium IDE

Answer

Selenese does not provide support for looping, but there is extension which could be used to achieve same. This extension can be download from here – http://51elliot.blogspot.com/2008/02/selenium-ide-goto.html

This extension can be added under “Selenium IDE Extension” section to use loop feature in Selenium IDE.


16. Can I use screen coordinate while using click command? I want to click at specific part of my element.

Answer

You would need to use clickAT command to achieve. clickAt command accepts element locator and x, y coordinates as arguments –

clickAt(locator, coordString)

 

17. How do I verify presence of drop down options using Selenium?

Answer

Use assertSelectOptions as following to check options in a drop down list –

assertSelectOptions

 

18. Can I get data from a specific html table cell using Selenium IDE?

Answer

Use storeTable command to get data from a specific cell in an html table, following example store text from cell 0,4 from an html table –

storeTable

css=#tableId.0.4

textFromCell

 

19. I want to make Selenium IDE record and display css locator followed by other locators, is it possible to give high priority to css locator in Selenium IDE?

Answer

You can change default behavior of Selenium IDE > element locator preference by crating js file with following–

LocatorBuilders.order = [‘css:name’, ‘css:id’, ‘id’, ‘link’, ‘name’, ‘xpath:attributes’];

And add this file under “Selenium IDE Extension” under Selenium Options.

 

20. My application has dynamic alerts which don’t always appear, how do I handle them?

Answer

If you want to simulate clicking “ok “ on alert than use – chooseOkOnNextConfirmation and if you want to simulate clicking “cancel” on alert than use – chooseCancelOnNextConfirmation ( )

 

21. Can I right click on a locator?

Answer

You can use command – contextMenu ( locator) to simulate right click on an element in web page.

 

22. How do I capture screen shot of page using Selenium IDE?

Answer

Use command – captureEntirePageScreenshot to take screen shot of page.

 

23. I want to pause my test execution after certain command.

Answer

Use pause command which takes time in milliseconds and would pause test execution for specified time – pause ( waitTime )

 

24. I used open command to launch my page, but I encountered time out errorL

Answer

This happens because open commands waits for only 30 seconds for page to load. If you application takes more than 30 sec then you can use “setTimeout ( timeout )” to make selenium IDE wait for specified time, before proceeding with test execution.

 

25. What’s the difference between type and type Keys commands?

Answer

type command simulates enter operations at one go while type Keys simulates keystroke key by key. type Keys could be used when typing data in text box which bring options (like Google suggestion list) because such operation are not usually simulated using type command.

If you are looking for Selenium with Java training in Bangalore, you are in right place. Our trainer has 15 – 20 years experienced in automation, currently they are working in top MNC company.

Comments