Created
July 9, 2021 02:37
-
-
Save Jaimin180296/dce4a3664440ef1a0b6f583b2bd64cd2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
from selenium.webdriver.chrome.options import Options | |
import time | |
desired_cap = { | |
'browser_version': 'latest', | |
'name': "camera_spoof", | |
'build': 'Camera Stream', | |
'os': 'OS X', | |
'os_version': 'Big Sur', | |
'browserName': 'Chrome', | |
'resolution': '1920x1080', | |
# Configure ChromeOptions to pass fake media stream | |
'chromeOptions': { | |
'args': ["--use-fake-device-for-media-stream", "--use-fake-ui-for-media-stream", | |
"--use-file-for-fake-video-capture=//Users//test1//Downloads//sample_640x360.mjpeg", | |
"--allow-file-access"] | |
} | |
} | |
driver = webdriver.Remote(command_executor='https://<username>:<password>@hub-cloud.browserstack.com/wd/hub', | |
desired_capabilities=desired_cap) | |
# WebCam Test | |
driver.maximize_window() | |
driver.get("https://filesamples.com/samples/video/mjpeg/sample_640x360.mjpeg") | |
time.sleep(10) | |
driver.get("https://webcamtests.com/check") | |
time.sleep(15) | |
driver.get("https://filesamples.com/samples/video/mjpeg/sample_640x360.mjpeg") | |
time.sleep(15) | |
driver.find_element_by_id("webcam-launcher").click() | |
time.sleep(20) | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment