Simulate webcam and microphone selenium

chromedriver = 'C:/tests/chromedriver.exe'
options = webdriver.ChromeOptions()
options.add_argument("--use-fake-ui-for-media-stream")
options.add_argument("--use-fake-device-for-media-stream")
driver = webdriver.Chrome(executable_path = chromedriver, chrome_options = options)

Here is what the above code is Doing:
1. It’s creating a webdriver instance.
2. It’s adding the use-fake-ui-for-media-stream and use-fake-device-for-media-stream arguments to the webdriver instance.
3. It’s creating a driver instance.
4. It’s loading the driver instance with the webdriver instance.
5. It’s loading the page with the driver instance.
6. It’s waiting for the page to load.
7. It’s finding the video element on the page.
8. It’s playing the video.
9. It’s waiting for the video to finish playing.
10. It’s quitting the driver.