Q:

selecting an element with no id and name from the typeahead list using css selector

I have to select an element from the auto-complete list.The item has no id and no name.
The following are the details of the inspected element:
<div class="abc-suggestion">
<p class="" style="white-space: normal;">
XYZ 
<span class="pull-right"/>

The css selector
.abc-suggestion takes me to 
<div class="abc-suggestion">

and 
.tt-suggestion>p to 
<p class="" style="white-space: normal;">

How can I select the element from the auto-complete list 'XYZ'
(I required to select an element for automating the application using selenium webdriver)

A:

I had a similar problem in Selenium if I understand your question but I don't want to guess. Can you please show the exact html markup for the <div class="abc-suggestion"> and be clear in what you're trying to select within it? 
Here's my understanding of your question: 

You want to select just the text "XYZ" and you say it has NO id and NO name, but yet, I see "XYZ" wrapped in a P tag. Furthermore, where does the P tag closes? 
Please be clear, I think I know what your problem is, it's a simple fix if you show the whole html snippet FOR the <div class="abc-suggestion"> and where that div closes; again just the html code for that div only and what you're tying to select within it should be enough for me or someone else to help you.

EDIT:
Try this: 
List<WebElement> paragraphList=null;
paragraphList=driver.findElements(By.cssSelector("span.tt-suggestions p")); 
String abcText=paragraphList.get(0).getText();
String xyzText=paragraphList.get(1).getText();

