Reputation: 33090
I have this in my code:
Public Shared Async Function SingSongs3() As Task
ias.fireFoxDriver.Navigate.GoToUrl("https://www.youtube.com/watch?v=ifCWN5pJGIE")
'ias.NavigateTillComplete("https://www.youtube.com/watch?v=ifCWN5pJGIE")
Await Task.Delay(60000)
ias.fireFoxDriver.Navigate.GoToUrl("http://google.com")
End Function
It's an alarm.
It works well. The problem is it doesn't really sound the alarm. That's because firefoxdriver block any autoplay with sound.
I can go to about:config and change that, and for that season, everything works well. I can do something like https://support.mozilla.org/en-US/kb/block-autoplay
However, the next time the program is run, the settings go back.
I wonder is there a way to programmatically change the setting so that autoplay with sound is not blocked.
I am thinking of doing something like
https://tarunlalwani.com/post/change-profile-settings-at-runtime-firefox-selenium/
Dim Profile = fireFoxDriver.FirefoxProfile()
Profile.set_preference("media.autoplay.blocking.policy", 0)
However, it doesn't work. There is no class called FirefoxProfile that is a member of firefoxdriver
I have imports Imports OpenQA.Selenium.Firefox
on top. No class named webdriver either.
I tried to use this class.
https://www.selenium.dev/selenium/docs/api/dotnet/html/T_OpenQA_Selenium_Firefox_FirefoxOptions.htm
Not sure how exactly I should do it.
Upvotes: 0
Views: 474