Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a recent interview I was asked the following question on a white board:

What is the name of this format “.//[@id=\'nosession\']/form/div[1]/input”?

I literally had no idea how to answer this, because I have never seen its format before. I know that it looks like a FindElement piece but I have never seen @id before the id and never have I come accross a \'nosession\' id before. Have any of you seen this? and how would you handle answering this question?

share|improve this question
up vote 10 down vote accepted

Looks like XPath locator to me, but this is not all.

TL;DR: Technical part of the question is just starting point to showcase your skills and experience.

When answering such technical interviewing questions, goal (unless you are explicitly said so) is not to give shortest answer, but to start conversation where you can showcase your skills and experience.

So after mentioning that string above is XPath locator (which is technical part of the answer), I would also mentioned how and why it is used, what are pros and cons, etc, like: locating web page elements by XPath is quite fragile, better way is (in order of preference) locate elements by id, name or CSS class, or by text.

In discussion you can also show that you have real-life experience of using mentioned technology. So (in case above) I would also asked if developers are open to add ids/names (with the goal to avoid using XPath if possible). If you are interviewing for a position of automated tester to write selenium test for outside web pages where your company have no control over the page code (developer will not help your testing by adding ids or names), then brace for locating elements by XPath, and prepare for constant breakage of your tests after slight page design changes.

Another angle would be to ask interviewer how deep into XPath they want me to go (analyzing what exactly this locator finds). As I said, because my developers cooperate (and I can add ids/names myself when needed), so if they need XPath guru, I would need to brush up my (rusty) skills for a position relying on XPath so heavily. But my gut feeling is (unless job description asks for XPath guru) such admission will show interviewer that I am aware of level of my skills (and need to enhance them), and would not be counted against me. Also, if XPath was mentioned in job description, prudent action would be to brush up on basics before interview (so such basic XPath question would be a softball for you).

Basically in answering question like this will help to show how technical problems relate to communication problems and people problems and to show that you do know the consequences and you did learned the lessons (if you do and did), to show experience beyond classroom knowledge. Best would be to mention some real life war story (if you have one) how your experience was beneficial.

From XPath you can move discussion i.e. how last-minute design changes can cause massive failure of automated tests using XPath (and how to make shared locators so you change them in one place), or commiserate how heroic week was needed to fix release (and better, what you learned, what changes you suggest to avoid such heroics next time).

This kind of real-life experience (debating real life war stories) cannot be faked (faking is easy to detect). So even if you do not identify the format correctly (or missed some fine points of XPath syntax) you can still show off your real life experience. One can learn XPath syntax in a week. Experience is much slower.

share|improve this answer

I'll start a conversation by saying it looks like an xpath.

Then I'll explain what element it is for and then start a talk about how it would work and share my knowledge around xpaths.

share|improve this answer

Answer in Short

This is Xpath .//[@id=\'nosession\']/form/div[1]/input

Which means, the Xpath is trying to find out an any html element on page, which has id as nosession. Inside the nosession element we have a form with multiple div tags in it and we are selecting first div[1]. Inside first div tag we are finding for input element.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.