mahesh nani mahesh nani - 29 days ago 6x
Node.js Question

Selenium get all options from drop down in node.js

How can I get all options from drop down using selenium with node.js

below is my code:

var dropdown = driver.findElement({xpath: '//*[@name="dropdownname"]'});

from above

var options = dropdown.findElements({tagName: 'option'});

how can i get all options and do foreach in node.js or print options values using node.js.

Thanks in advance.

driver.findElement({xpath: '//*[@name="dropdownnamewithoptions"]'}).then(function(webElement) {
                        if(optionArray.length > 1){
                                  optionArray[0].getAttribute('value').then(function(optionValue) {
                 }, function(err) {