Selenium Testing Framework Regulatory Frameworks & Compliance 2 — Questions and Answers
Question 1: Which WCAG success criterion requires that all non-text content has a text alternative, and how can Selenium verify this?
- WCAG 1.1.1 — check alt attributes on img elements via getAttribute('alt') (Correct answer)
- WCAG 2.4.1 — check aria-label on all interactive elements
- WCAG 1.3.1 — check role attributes on semantic elements
- WCAG 3.1.1 — check lang attribute on the html element
Correct answer: WCAG 1.1.1 — check alt attributes on img elements via getAttribute('alt')
WCAG 1.1.1 (Non-text Content) mandates alt text on images, which Selenium can verify by retrieving the alt attribute using getAttribute('alt').
Question 2: Under HIPAA's Security Rule, when automating tests against a healthcare application, which Selenium practice is non-compliant?
- Logging PHI-containing response data to a shared test report (Correct answer)
- Using HTTPS endpoints in test configurations
- Running tests in an isolated staging environment
- Clearing browser cookies after each test session
Correct answer: Logging PHI-containing response data to a shared test report
Logging Protected Health Information (PHI) to shared test reports violates HIPAA's Security Rule, which requires PHI to be safeguarded and access-controlled.
Question 3: A Selenium test suite must validate PCI DSS compliance. Which assertion confirms a payment page correctly masks a credit card PAN?
- Verify the displayed value matches regex \*{12}\d{4} (Correct answer)
- Check that the input field has type='password'
- Assert the network response body contains the full PAN
- Confirm the field has autocomplete='off'
Correct answer: Verify the displayed value matches regex \*{12}\d{4}
PCI DSS requires masking all digits except the last four, so asserting the displayed value matches the pattern of 12 asterisks followed by 4 digits validates proper masking.
Question 4: When Selenium tests must comply with GDPR's right to erasure, which automated test scenario is most relevant?
- Submit a deletion request and verify the user account no longer appears in search results (Correct answer)
- Verify cookie consent banners appear on page load
- Assert that opt-out checkboxes are pre-unchecked by default
- Check that privacy policy links open in a new tab
Correct answer: Submit a deletion request and verify the user account no longer appears in search results
GDPR's Article 17 (right to erasure) is validated by testing that a deletion request results in the user's data being removed from all accessible views.
Question 5: Which Selenium WebDriver command is most appropriate when testing Section 508 compliance for keyboard-only navigation?
- sendKeys(Keys.TAB) to cycle through focusable elements (Correct answer)
- driver.executeScript('document.querySelector("a").click()')
- Actions.moveToElement(element).click()
- driver.get(url + '#main-content')
Correct answer: sendKeys(Keys.TAB) to cycle through focusable elements
Section 508 requires full keyboard operability, so using TAB key navigation via sendKeys(Keys.TAB) accurately simulates how keyboard-only users traverse the page.
Question 6: Under SOX compliance, which aspect of a Selenium test framework audit trail is most critical?
- Immutable logs of test execution showing which financial report screens were accessed and when (Correct answer)
- Screenshot frequency during test runs
- The number of assertions per test case
- Browser version used during testing
Correct answer: Immutable logs of test execution showing which financial report screens were accessed and when
SOX requires verifiable audit trails for financial systems, so immutable, timestamped logs of which screens were accessed during automated testing support compliance documentation.
Question 7: A QA team uses Selenium to test a children's website. Which COPPA-related check should be automated?
- Verify that users under 13 cannot complete registration without parental consent verification (Correct answer)
- Assert that all images have alt text
- Check that the site loads within 3 seconds
- Confirm the privacy policy is linked in the footer
Correct answer: Verify that users under 13 cannot complete registration without parental consent verification
COPPA (Children's Online Privacy Protection Act) mandates verifiable parental consent before collecting personal data from children under 13.
Which WCAG success criterion requires that all non-text content has a text alternative, and how can Selenium verify this?