I am using watir web driver for web scraping, where I fill the form and get the results. The results also includes the dropdown list, from where I have to extracted the currently selected text. I have used following queries.
selectedList = browser.select_list(:id => "itemType")
From this i can use following query:
selectedText = selectedList.selected_options.map(&:text)[0]
Using this query, I am able to get the selected text. But the problem is, the drop-down list contains thousands of options, and watir is taking too long to find the selected option using this query.
Any faster method is appreciated. Also I have tried with following queries:
selected = selectedList.selected_options()[0]
selectedText = selected.text
But the problem is same. I have other dropdowns with smaller options, where both of these queries are performing good, but with thousands of options, its really slow.