Hello I have been looking for a while now but I can't seem to find a way to do this maybe it does not exist?
I have a java app that use selenium to open a music player from website. Problem is the player from the website have the sound at max everytime i open it, I would like to be able to set the volume to half or something.
Now I have seen some people talk about dragging the slider of the player but in this case I can't seem to be able to get the xpath of the player, maybe because it is a player that is embed.
So what I am looking for is a way to change the windows sound that is linked to the new window created by the Webdriver.
Any help would be amazing !
( the player : link if someone wants to check the xpath or whatever )
The idea is to locate the audio
tag and set the volume
property through javascript:
volume
The playback volume of any audio portions, in the range 0.0 (silent) to 1.0 (loudest).
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(ExpectedConditions.presenceOfElementLocated(By.tagName("audio")));
if (driver instanceof JavascriptExecutor) {
((JavascriptExecutor) driver).executeScript("arguments[0].volume = 0.5;", element);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.