Testing NW.js Application Loading and DOM Content Verification in nw.js
This test suite validates the loading and rendering of NW.js application content using Selenium WebDriver integration. It focuses on verifying proper initialization and DOM element accessibility within the NW.js runtime environment.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
nwjs/nwJs
test/sanity/issue7197-load/test.py
import time
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from nw_util import *
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common import utils
test_dir = os.path.dirname(os.path.abspath(__file__))
chrome_options = Options()
chrome_options.add_argument("nwapp=" + test_dir)
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options)
driver.implicitly_wait(5)
try:
print(driver.current_url)
result = driver.find_element_by_tag_name('h1')
ret = result.get_attribute('innerHTML')
print(ret)
assert("NW.js" in result.get_attribute('innerHTML'))
finally:
driver.quit()