select_js = """
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
ele = getElementByXpath(arguments[0]);
ele.readOnly = false;
ele.value = arguments[1];
"""
driver.execute_script(select_js, "//select[@id='Agency']/following-sibling::div//input",'推荐机构会员20190715')
# 自定义函数getElementByXpath(),通过传入xpath路径获取元素。
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}