cancel
Showing results for 
Search instead for 
Did you mean: 

Select drop down problems

SOLVED
Occasional Contributor

Select drop down problems

I am having problem to select a drop down item with ClickItem(), it was working before until the tags "select and option" have been replaced with "div".

It was  working with these below html tags with select and options

e.g 

<select id='dropDownMenu'>
  <option value='foo'>Title1</option>
  <option value='bar'>Title2</option>
</select>

but it is not working with the below example for the html  

<div id='dropDownMenu'>
  <div value='foo'>Title1</div>
  <div value='bar'>Title2</div>
</div>

Could you please let me know if there is any other method to select the dropdown without using the ClickItem() 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Select drop down problems

Hi,

 

The problem is that initially the page had a real dropdown with a set of its items. Thus .SelectItem() method worked.

Now your page does not have any dropdown but has just a set of unrelated div elements. They are interacting like dropdown only due to some page script code, but not because the browser renders and handle them as a dropdown.

Your only option is to implement a new test code that will search for the new 'dropdown' (by the value of id, for example) and click the found object in order to 'open' the 'list of dropdown values'. Then the code must search for the required child div, scroll it into view if the found item is not visible on the screen (this can be done with the help of the .scrollIntoView() native DOM method), and click the found item.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
1 REPLY 1
Community Hero

Re: Select drop down problems

Hi,

 

The problem is that initially the page had a real dropdown with a set of its items. Thus .SelectItem() method worked.

Now your page does not have any dropdown but has just a set of unrelated div elements. They are interacting like dropdown only due to some page script code, but not because the browser renders and handle them as a dropdown.

Your only option is to implement a new test code that will search for the new 'dropdown' (by the value of id, for example) and click the found object in order to 'open' the 'list of dropdown values'. Then the code must search for the required child div, scroll it into view if the found item is not visible on the screen (this can be done with the help of the .scrollIntoView() native DOM method), and click the found item.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
New Here?
Join us and watch the welcome video:
Top Kudoed Authors