Testing IFrame Cookie Management Integration in NW.js
This test suite validates iframe cookie handling in NW.js applications using Selenium WebDriver. It specifically tests the interaction between Chrome’s cookie management and NW.js iframe implementations to ensure proper domain-specific cookie persistence.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
nwjs/nwJs
test/sanity/issue7173-iframe/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
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)
driver.implicitly_wait(2)
try:
print(driver.current_url)
cookie = wait_for_element_id_content(driver, 'ret', 'nwjs.io', 20)
print(cookie)
finally:
driver.quit()