I have this js code to remove some hidden dropdown element:
//select account from dropdown using javascript val js: JavascriptExecutor = driver.asInstanceOf[JavascriptExecutor] js.executeScript("$('.select-upload_company_id>.center').html(" + invoice.companyNumber + ")") //visible one val cmd: String = "$('#company_id option[value=\"" + invoice.companyNumber + "\"]').eq(1).attr('selected','selected')" //hidden js.executeScript(cmd)
currently its selecting by value, but I want to select by visible text....how do I do that here? what do I need to change in this code?
thanks