RunScript is almost exactly the same as executeScript
The only difference is that “Run Script” does not store a script result value in a variable like executeScript does. But of course that is not important. => You can simply use executeScript instead.
Here I show you some code that I’ve used to select from a dropdown, running it from executeScript:
function getElementByXpath(path) { return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; } function setSelectedValue(selectObj, valueToSet) { for (var i = 0; i < selectObj.options.length; i++) { if (selectObj.options[i].text== valueToSet) { selectObj.options[i].selected = true; return; } } } var b = getElementByXpath("/html/body/form/div[11]/table/tbody/tr/td/table/tbody/tr[3]/td[2]/select");//example of path setSelectedValue(b,"H"); // select option H b.onchange();
that is that maybe it is not finding the path you gave it
did you change the xpath from the line var b = getElementByXpath("HERE ENTER THE XPATH OF THE DROP MENU"); ?