I am trying to figure out how to reduce the volume slider to 0% as it starts somewhere are 80%-ish and loud and annoying when testing.
volume slider html:
volume slider html:
<div class="controls-group control-bar inflexible" data-reactid=".0.0.3.2.1.2">
<div class="btn cs-button volume " data-reactid=".0.0.3.2.1.2.0">
<button class="btn-unstyled text-align-middle" data-reactid=".0.0.3.2.1.2.0.0" style="zoom:100.5%;transform:translate(0px, 0px) scale(0.9950248756218907) translate(0px, 0px) ;">
<svg class="cs-icon" data-reactid=".0.0.3.2.1.2.0.0.0" height="15" style="zoom:100.5%;transform:translate(0px, 0px) scale(0.9950248756218907) translate(0px, 0px) ;" viewbox="0 0 15 15" width="15">
<use class="cs-icon-shadow" transform="translate(0, 1)" xlink:href="#player-volume" xmlns:xlink="http://www.w3.org/1999/xlink">
</use>
<g id="player-volume">
<polygon points="4.3,10.7 0,10.7 0,4.3 4.3,4.3 8.6,0 8.6,15">
</polygon>
<rect class="" height="6" width="1" x="10" y="5">
</rect>
<rect class="" height="8" width="1" x="12" y="4">
</rect>
<rect class="hidden" height="10" width="1" x="14" y="3">
</rect>
</g>
</svg>
<span class="accessibility" data-reactid=".0.0.3.2.1.2.0.0.1">
volume
</span>
</button>
<div class="btn cs-volume cs-button slider-bar hidden " data-reactid=".0.0.3.2.1.2.0.1" id="control-volume-slider" style="zoom:100.5%;transform:translate(0px, 0px) scale(0.9950248756218907) translate(0px, 0px) ;">
<input aria-orientation="vertical" class="cs-volume" data-reactid=".0.0.3.2.1.2.0.1.0" max="1.0" min="0" step="0.1" type="range" value="0.8"/>
</div>
</div>
</div>If you click the volume button the slider bar appears above it. The element of the actual slider bar is<div class="btn cs-volume cs-button slider-bar " style="zoom:100.5%;transform:translate(0px, 0px) scale(0.9950248756218907) translate(0px, 0px) ;" id="control-volume-slider" data-reactid=".0.0.3.2.1.2.0.1"><input class="cs-volume" type="range" min="0" max="1.0" value="0.8" step="0.1" aria-orientation="vertical" data-reactid=".0.0.3.2.1.2.0.1.0"></div>This is my code for attempting to slide that slider bar down to 0%
def set_volume(self):
btn = self.browser.find_element_by_xpath('//*[@id="main-window"]/div[2]/div[1]/div/button')
btn.click() #click volume button to enable slider control
slider_class = 'btn cs-volume cs-button slider-bar hidden '
slider = self.browser.find_element_by_id('control-volume-slider')
height = slider.size['height']
width = slider.size['width']
move = ActionChains(self.browser)
percent = 100
if width > height:
direction_offset = width
else:
direction_offset = width
move.click_and_hold(slider).move_by_offset(percent * direction_offset / 100, 0).release().perform()I am not sure if there is a method of selenium to just set the id value to 0.0 (or maybe there is a javascript method) or if you have to manually slide the bar down. I attempted the latter, but i cannot seem to figure the proper method out?
Recommended Tutorials:
