Selenium Interview Questions part 6

In this selenium interview questions series, we will cover questions from basics to advance level which are mostly asked in companies interviews.You are also welcome to add questions faced by you in interviews. It may help some one. If you find any discrepancies in answers or have any suggestion , do let us know.

Note : You can add questions and answer in comments section after the post. We will add them to the series if not duplicated.

51) How do you perform mouse operations?

You can use the selenium class named as  Actions to perform the mouse operations. You need to use methods build and perform after using the methods like click(),doubleClick() etc.

52) How do you double click on any element in a webpage?

WebElement element = driver.findElement(“ElementID”));
Actions act = new Actions(driver);

53) Can we perform drag and drop operation on any element?

Yes, we can do this by using Actions class only. We need to create the source and destination webelement first.

WebElement source = driver.findElement(“Source ElementID”));
WebElement destination = driver.findElement(“Taget ElementID”));
Actions act = new Actions(driver);
act.dragAndDrop(source, destination ).perform();

54) How do we submit a form using Selenium?

WebElement element = driver.findElement(“ElementID”));

55) Explain how you can login into any site if it’s showing any authentication popup for password and username?

Pass the username and password with url
ex- http://shekhar:[email protected]

56) What is the use of Firefox Profiling and how do we create it?

Click here for the answer..

57) How to handle internationalisation through web driver?


FirefoxProfile profile = new FirefoxProfile();
profile.set Preference(“intl.accept_languages”,”jp”);
Web driver driver = new FirefoxDriver(profile);

It will open google in Japanese language.

58) Can u write a code for printing in selenium?

There are two cases:

Case1. Any hyperlink/button on a web page, and clicking that link/button will open a print dialog box .(i.e. perform an action on a web page)

Case2. Open print dialog box within your own script, not by performing any action on web page.

Case 1 answer : Just a call for event will work to open it.

Case 2 answer : Call a Printer Job object (Use Awt API). You can check code details here..

59) How will you work with multiple browser windows?

Click here for the answer..

60) Is there a way to click hidden LINK in web driver?

You can use javascript executor and change its css property. You can give it a try , in some cases it might not work.

String Block1 = driver.findElement(“element ID”));
JavascriptExecutor js1=(JavascriptExecutor)driver; js1.executeScript(“$(“+Block1+”).css({‘display’:’block’});”);
Avatar photo

Shekhar Sharma

Shekhar Sharma is founder of This website is his window to the world. He believes that ,"Knowledge increases by sharing but not by saving".

You may also like...