Testing Desktop Media Selection Integration in NW.js
This test suite validates the screen.chooseDesktopMedia functionality in NW.js using Selenium WebDriver for automated browser testing. It verifies the proper selection and handling of desktop media sources through Chrome’s implementation.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
nwjs/nwJs
test/sanity/screen-choosedekstopmedia/test.py
import time
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options)
try:
driver.implicitly_wait(10)
print(driver.current_url)
result = driver.find_element_by_id('result')
print(result.get_attribute('innerHTML'))
assert("success" in result.get_attribute('innerHTML'))
finally:
driver.quit()