Click the terms checkboxes directly, not the required row
.validate-required is on every required checkout field, so the old selector's first match was usually a text input, and on the terms row the click landed in the empty half of a full-width <p> beside the box. Target the checkbox input in a required row and gate on :not(:checked) so the two clicks tick box one then box two instead of toggling the same box twice; the second is skipIfNotFound in case a checkout has only one. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
2d0c87b900
commit
7d677dfa89
+10
-2
@@ -288,8 +288,16 @@ export const FIRMS: Firm[] = [
|
|||||||
{ action: 'click', selector: 'input#coupon_code, input[name="coupon_code"], input#coupon_code_field', frame: '#woocommerceModal iframe', label: 'Focus coupon field' },
|
{ action: 'click', selector: 'input#coupon_code, input[name="coupon_code"], input#coupon_code_field', frame: '#woocommerceModal iframe', label: 'Focus coupon field' },
|
||||||
{ action: 'type', selector: 'input#coupon_code, input[name="coupon_code"], input#coupon_code_field', frame: '#woocommerceModal iframe', text: 'THEPROPFARM', label: 'Enter coupon' },
|
{ action: 'type', selector: 'input#coupon_code, input[name="coupon_code"], input#coupon_code_field', frame: '#woocommerceModal iframe', text: 'THEPROPFARM', label: 'Enter coupon' },
|
||||||
{ action: 'click', selector: 'button#apply_coupon_button', frame: '#woocommerceModal iframe', label: 'Apply coupon' },
|
{ action: 'click', selector: 'button#apply_coupon_button', frame: '#woocommerceModal iframe', label: 'Apply coupon' },
|
||||||
{ action: 'click', selector: '.validate-required:not(.woocommerce-validated)', frame: '#woocommerceModal iframe', label: 'Agree to terms' },
|
// Target the checkbox itself, not the .validate-required
|
||||||
{ action: 'click', selector: '.validate-required:not(.woocommerce-validated)', frame: '#woocommerceModal iframe', label: 'Agree to terms 2' },
|
// row: that class is on every required field (name, email,
|
||||||
|
// …), so its first match is usually a text input, and even
|
||||||
|
// on the terms row the click lands in the empty right half
|
||||||
|
// of a full-width <p> rather than on the box. `:not(:checked)`
|
||||||
|
// makes the two clicks self-sequence — the first tick checks
|
||||||
|
// box one, so the second click resolves to box two — and
|
||||||
|
// re-clicking never un-ticks a box already checked.
|
||||||
|
{ action: 'click', selector: '.validate-required input[type="checkbox"]:not(:checked)', frame: '#woocommerceModal iframe', label: 'Agree to terms' },
|
||||||
|
{ action: 'click', selector: '.validate-required input[type="checkbox"]:not(:checked)', frame: '#woocommerceModal iframe', skipIfNotFound: true, label: 'Agree to terms 2' },
|
||||||
|
|
||||||
{ action: 'waitFor', selector: '#woocommerceModal', absent: true, hidden: true, timeoutSeconds: 30, label: 'Wait for the modal to close' },
|
{ action: 'waitFor', selector: '#woocommerceModal', absent: true, hidden: true, timeoutSeconds: 30, label: 'Wait for the modal to close' },
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user