I am using Nightmare to doing some screen caps on a site. This below is a small dropdown in a site with many different option values. Note that this is Nightmare and not in Phantomjs. Although same the coding slightly differs. Not sure how to traverse the option values when there is no name to call from.
<div class="filterRegionAndDistrict">
<select name="selectRegionAndDistrict" data-bind="foreach: $root.regionsAndDistricts, value: selectedGroupOption">
<option data-bind="text: text, option: $data" value="">All</option>
<option data-bind="text: text, option: $data" value="">TR1</option>
<option data-bind="text: text, option: $data" value="">TR2</option>
<option data-bind="text: text, option: $data" value="">TR3</option>
my nightmare script captures all but only I am unable to drill down to the options of selecting say TR4
This one works
.click('select[name="selectRegionAndDistrict"]')
.viewport(1280, 1000)
.wait(5000)
.screenshot('captures/region01.png')
This one does not works:
.click('option[text="TR4"]')
.viewport(1280, 1000)
.wait(5000)
.screenshot('captures/TR4.png')
Any suggestions? How do I traverse down this drop-down options menu?