我正在尝试在网页上控制基于JS的滑块。元素检查显示该滑块的以下代码:
<fieldset id="slider_container" class="margin-v-m padding-hr-m fixed-width-filter-column" _ngcontent-pik-25="">
<div class="form-group" _ngcontent-pik-25="">
<div class="form-group" _ngcontent-pik-25="">
<div class="form-group" _ngcontent-pik-25="">
<div class="form-group" _ngcontent-pik-25="">
<label _ngcontent-pik-25="">Benchmark Geography</label>
<div class="form_control" _ngcontent-pik-25="">
<div id="" class="slider slider-horizontal" style="margin-bottom: 21px;">
<div class="slider-track">
<div class="tooltip tooltip-main top hide" role="presentation" style="left: 16.6667%; margin-left: 0px;">
<div class="tooltip tooltip-min top hide" role="presentation" style="left: 0%; margin-left: 0px;">
<div class="tooltip tooltip-max top hide" role="presentation" style="left: 33.3333%; margin-left: 0px;">
<div class="slider-tick-label-container" style="margin-left: -53.3333px;">
<div class="slider-tick-container">
<div class="slider-handle min-slider-handle round" role="slider" aria-valuemin="1" aria-valuemax="4" style="left: 0%;" aria-valuenow="1" tabindex="0"></div>
<div class="slider-handle max-slider-handle round" role="slider" aria-valuemin="1" aria-valuemax="4" style="left: 33.3333%;" aria-valuenow="2" tabindex="0"></div>
</div>
<input id="geo_slider" class="span2" _ngcontent-pik-25="" data-slider-max="4" data-slider-min="1" data-slider-step="1" data-slider-ticks="[1, 2, 3, 4]" data-slider-ticks-labels="["Market", "District", "Region", "Country"]" data-slider-tooltip="hide" data-slider-value="[1,2]" value="1,2" style="display: none;" data-value="1,2" type="text">
</div>
</div>
</fieldset>
这是滑块的默认状态,我需要它才能进入这种状态:
<fieldset id="slider_container" class="margin-v-m padding-hr-m fixed-width-filter-column" _ngcontent-pik-25="">
<div class="form-group" _ngcontent-pik-25="">
<div class="form-group" _ngcontent-pik-25="">
<div class="form-group" _ngcontent-pik-25="">
<div class="form-group" _ngcontent-pik-25="">
<label _ngcontent-pik-25="">Benchmark Geography</label>
<div class="form_control" _ngcontent-pik-25="">
<div id="" class="slider slider-horizontal" style="margin-bottom: 21px;">
<div class="slider-track">
<div class="tooltip tooltip-main top hide" role="presentation" style="left: 0%; margin-left: 0px;">
<div class="tooltip tooltip-min top hide" role="presentation" style="left: 0%; margin-left: 0px;">
<div class="tooltip tooltip-max top hide" role="presentation" style="left: 0%; margin-left: 0px;">
<div class="slider-tick-label-container" style="margin-left: -53.3333px;">
<div class="slider-tick-container">
<div class="slider-handle min-slider-handle round" role="slider" aria-valuemin="1" aria-valuemax="4" style="left: 0%;" aria-valuenow="1" tabindex="0"></div>
<div class="slider-handle max-slider-handle round" role="slider" aria-valuemin="1" aria-valuemax="4" style="left: 0%;" aria-valuenow="1" tabindex="0"></div>
</div>
<input id="geo_slider" class="span2" _ngcontent-pik-25="" data-slider-max="4" data-slider-min="1" data-slider-step="1" data-slider-ticks="[1, 2, 3, 4]" data-slider-ticks-labels="["Market", "District", "Region", "Country"]" data-slider-tooltip="hide" data-slider-value="[1,2]" value="1,1" style="display: none;" data-value="1,1" type="text">
</div>
</div>
</fieldset>
如何使用Selenium Webdriver和Python进行此操作?