0

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.

Fahim Uz Zaman
  • 444
  • 3
  • 6
user4951
  • 32,206
  • 53
  • 172
  • 282
  • this is an expected behaviour https://hacks.mozilla.org/2019/02/firefox-66-to-block-automatically-playing-audible-video-and-audio/ You looking for a hack? – Anatsu Oct 08 '20 at 16:35
  • I want my program to be able to run youtube video automatically. And I want that to happen without the user have to turn on autoplay everytime the program run – user4951 Oct 09 '20 at 00:12
  • I think there is a profile class that I can update before creating the firefox class – user4951 Oct 09 '20 at 00:14

0 Answers0