You need to tell it to return the value. Change this line: String mainURL = (String) js.executeScript("productObj.mainURL"); to: String mainURL = (String) js.executeScript("return productObj.mainURL");
Yes, it does, and even if we (our company) don't do it currently, we are working towards it as a goal. One way (to gain speed) is use PhantomJS - headless browser (it executes all commands but does not paint screen unless you want a snapshot). This might, or might not, count as "browser environment". Another way is to use advanced JS framework like ...
Someone develop a webdriverjs-helper: https://github.com/surevine/webdriverjs-helper This helper provide a function to get the values of a dropdown: browser.dropdownlist(selector).value(valueHandler) https://github.com/surevine/webdriverjs-helper#browserdropdownlistselectorvaluesvalueshandler
Top 50 recent answers are included