im using selenium to automate some website. There is one dorpdown that is giving me hard time since it it not the native one, cause they used some custom designed one. so I need to set its css class to hidden so I can get to the native one easily.
this is before I clicked on it:
this is after:
so now how do I do it automatically with js? I tried something like this that didnt work :
You are using the wrong CSS selector: ".selectpicker select" means "the select elements child of elements having the selectpicker class"
you want the select element having the selectpicker class.
it will set "display:block" on this element and it will be visible.
from the selectpicker doc (https://silviomoreto.github.io/bootstrap-select/). Hide the custom select & show the native one. As the select has
display:none!important we need to force it to show.
There is three way of doing it:
remove the specific classes "selectpicker" and "bs-select-hidden" that makes it hidden.
$('select.selectpicker').selectpicker('hide') .removeClass("selectpicker bs-select-hidden");
remove all classes (may break the layout)
display:inline-block(default display value for selects)
$('select.selectpicker').selectpicker('hide') .css("display","inline-block !important");