Software Test Automation Interview Questions

3,425 software test automation interview questions shared by candidates

I was asked some questions like below. Two or 3 questions were incorrect. Panel is inexperienced in automation even if you tell them the right answer they want to hear what they know. 1. How would you handle dynamic Xpath ? Xpath was as following: '//div[@ID='abc-64613216543'/div[1]/div[1]/input[1]']'. in this xpath they said ID is changing every time page gets refreshed. My Answer: Xpath is not changing because except nodes only id is changing so Xpath location would remain same. so in this question I only need to find that changing id's numeric portion. So I told them first of all I would find a parent tag or xpath then will get id of the first child's tag. It is obvious that there will be something above this xpath. so I wrote:List<WebElement> le = driver.findElement(By.id("")).findElements(By.tagName("div")); String xid = le.get(0).getAttribute("ID"); String xpath = "'//div[@ID='"+xid+"'/div[1]/div[1]/input[1]'"; This can solve their query very well. But they were not able to understand becauase they might have different way to do that. 2. A date calendar was given and i was suppose to set value in it. But value field is label which is not editable. so they asked me how many times I would click on the calander's month/year button to set the date. Date was: 1-aug-2016 and I was suppose to set 30-July-2016. I told them this kind of popup is javascript/jquery popup and we need not to click on any button inside that popup because in every month/year days location get changed. even if I set the required date using mouse click then this approach will fail in future. So I told them to set value attribute = 30-July-2016 of that tag. But they keep on saying that label control is not editable. We can do anything with a website with the help of jsexecutor if control is readonly = true, we can set readonly= false. I did it myself hundred of time and it works. 3. Asked some sql queries, like follow select, delete, truncate, update. 4. Asked me difference between truncate and delete ans: 1. Truncate is faster than delete 2. Truncate deletes all rows from a table. 3. Truncate need not any where close. 4. Truncate reset the table. further question on this: What is the main difference in these two commands ? I was looking at the interviewer face. all these difference are the main but they were expecting some other reason which they know. and they they asked if there is a primary key on this table then what will happen with the id table. I explained: IF there is a primary key and we delete a row then user can enter same id number but if there is an identity set with the primary key then if we delete a row then next new id value will be deleted id + 1. But they again don't under stand. 5. What frame work are you using: and: Module based + data driven. I explained them the structure like: Module libraries. Common functions: field highlight, db interaction, locator etc Script feeding: properties file, text, excel or sql db etc. Test output: testng report. then one of them asked why are you using common function ? I was again looking at their faces with open jaws. 6. Analytical questions: what is the center of the table where we were sitting ? It was round table and anybody can tell where it is. You have 8 balls which is the lightest one ?find in two attempts this question might need more time to solve I did not answer it in 2 mins. but when I sit in my car I had the answer. sometime we need time to think. this is the question which I did not answer except all.
avatar

Senior Automation Tester

Interviewed at BD

3.8
Aug 3, 2016

I was asked some questions like below. Two or 3 questions were incorrect. Panel is inexperienced in automation even if you tell them the right answer they want to hear what they know. 1. How would you handle dynamic Xpath ? Xpath was as following: '//div[@ID='abc-64613216543'/div[1]/div[1]/input[1]']'. in this xpath they said ID is changing every time page gets refreshed. My Answer: Xpath is not changing because except nodes only id is changing so Xpath location would remain same. so in this question I only need to find that changing id's numeric portion. So I told them first of all I would find a parent tag or xpath then will get id of the first child's tag. It is obvious that there will be something above this xpath. so I wrote:List<WebElement> le = driver.findElement(By.id("")).findElements(By.tagName("div")); String xid = le.get(0).getAttribute("ID"); String xpath = "'//div[@ID='"+xid+"'/div[1]/div[1]/input[1]'"; This can solve their query very well. But they were not able to understand becauase they might have different way to do that. 2. A date calendar was given and i was suppose to set value in it. But value field is label which is not editable. so they asked me how many times I would click on the calander's month/year button to set the date. Date was: 1-aug-2016 and I was suppose to set 30-July-2016. I told them this kind of popup is javascript/jquery popup and we need not to click on any button inside that popup because in every month/year days location get changed. even if I set the required date using mouse click then this approach will fail in future. So I told them to set value attribute = 30-July-2016 of that tag. But they keep on saying that label control is not editable. We can do anything with a website with the help of jsexecutor if control is readonly = true, we can set readonly= false. I did it myself hundred of time and it works. 3. Asked some sql queries, like follow select, delete, truncate, update. 4. Asked me difference between truncate and delete ans: 1. Truncate is faster than delete 2. Truncate deletes all rows from a table. 3. Truncate need not any where close. 4. Truncate reset the table. further question on this: What is the main difference in these two commands ? I was looking at the interviewer face. all these difference are the main but they were expecting some other reason which they know. and they they asked if there is a primary key on this table then what will happen with the id table. I explained: IF there is a primary key and we delete a row then user can enter same id number but if there is an identity set with the primary key then if we delete a row then next new id value will be deleted id + 1. But they again don't under stand. 5. What frame work are you using: and: Module based + data driven. I explained them the structure like: Module libraries. Common functions: field highlight, db interaction, locator etc Script feeding: properties file, text, excel or sql db etc. Test output: testng report. then one of them asked why are you using common function ? I was again looking at their faces with open jaws. 6. Analytical questions: what is the center of the table where we were sitting ? It was round table and anybody can tell where it is. You have 8 balls which is the lightest one ?find in two attempts this question might need more time to solve I did not answer it in 2 mins. but when I sit in my car I had the answer. sometime we need time to think. this is the question which I did not answer except all.

Viewing 451 - 460 interview questions

Glassdoor has 3,425 interview questions and reports from Software test automation interviews. Prepare for your interview. Get hired. Love your job.